Type.registerNamespace("SuperMap.Web.Resources");
SuperMap.Web.Resources.Resource = function() {
};
SuperMap.Web.Resources.Resource.locale = "zh_cn";
SuperMap.Web.Resources.Resource.getMessage = function(bundleName, key, message) {
    var res = eval(bundleName + "." + SuperMap.Web.Resources.Resource.locale + "." + key);
    res = res.replace("<message>", message);
    return res;
};
SuperMap.Web.Resources.Resource.registerClass("SuperMap.Web.Resources.Resource", null, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Core");
SuperMap.Web.Core.Point = function(a, b) {
    if (a || b) {
        if (typeof(a) != "number" || typeof(b) != "number") {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Point_Constructor_ParamsError"));
        }
    }
    if (a == 0 || a) {
        this.x = a;
    } else {
        this.x = NaN;
    }
    if (b == 0 || b) {
        this.y = b;
    } else {
        this.y = NaN;
    }
};
SuperMap.Web.Core.Point.prototype = {
    toString: function() { return "(" + this.x + ", " + this.y + ")"; },
    copy: function(a) {
        var b = Function._validateParams(arguments, [{ name: "point", type: SuperMap.Web.Core.Point }]);
        if (b) {
            throw b;
        }
        this.x = a.x;
        this.y = a.y;
    },
    equals: function(a) {
        if (!SuperMap.Web.Core.Point.isInstanceOfType(a)) {
            return false;
        }
        if (a.x == this.x && a.y == this.y) {
            return true;
        } else {
            return false;
        }
    },
    isEmpty: function() {
        if (isNaN(this.x) || isNaN(this.y) || this.x == null || this.y == null) {
            return true;
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.Point.fromJson = function(jsonObject) {
    if (!jsonObject) {
        return null;
    }
    var object = jsonObject;
    if (typeof(jsonObject) === "string") {
        object = eval("(" + jsonObject + ")");
    }
    var point = new SuperMap.Web.Core.Point(object.x, object.y);
    return point;
};
SuperMap.Web.Core.Point.registerClass("SuperMap.Web.Core.Point");
SuperMap.Web.Core.Point2D = function(a, b) {
    if (a || b) {
        if (typeof(a) != "number" || typeof(b) != "number") {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Point2D_Constructor_ParamsError"));
        }
    }
    if (a == 0 || a) {
        this.x = a;
    } else {
        this.x = NaN;
    }
    if (b == 0 || b) {
        this.y = b;
    } else {
        this.y = NaN;
    }
};
SuperMap.Web.Core.Point2D.prototype = {
    toString: function() { return "(" + this.x + ", " + this.y + ")"; },
    copy: function(b) {
        var a = Function._validateParams(arguments, [{ name: "point2D", type: SuperMap.Web.Core.Point2D }]);
        if (a) {
            throw a;
        }
        this.x = b.x;
        this.y = b.y;
    },
    equals: function(a) {
        if (!SuperMap.Web.Core.Point2D.isInstanceOfType(a)) {
            return false;
        }
        if (a.x == this.x && a.y == this.y) {
            return true;
        } else {
            return false;
        }
    },
    isEmpty: function() {
        if (isNaN(this.x) || isNaN(this.y) || this.x == null || this.y == null) {
            return true;
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.Point2D.fromJson = function(jsonObject) {
    if (!jsonObject) {
        return null;
    }
    if (typeof(jsonObject) === "string") {
        jsonObject = eval("(" + jsonObject + ")");
    }
    var point2D = new SuperMap.Web.Core.Point2D(jsonObject.x, jsonObject.y);
    return point2D;
};
SuperMap.Web.Core.Point2D.registerClass("SuperMap.Web.Core.Point2D");
SuperMap.Web.Core.Rectangle = function(d, c, b, a) {
    if (d || a || b || c) {
        if (typeof(d) != "number" || typeof(a) != "number" || typeof(b) != "number" || typeof(c) != "number" || d > b || c > a) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle_Constructor_ParamsError"));
        }
    }
    this.leftTop = new SuperMap.Web.Core.Point(d, c);
    this.rightBottom = new SuperMap.Web.Core.Point(b, a);
};
SuperMap.Web.Core.Rectangle.prototype = {
    toString: function() { return "(" + (this.leftTop ? this.leftTop.toString() : "null") + ", " + (this.rightBottom ? this.rightBottom.toString() : "null") + ")"; },
    clone: function() { return new SuperMap.Web.Core.Rectangle(this.leftTop.x, this.leftTop.y, this.rightBottom.x, this.rightBottom.y); },
    copy: function(a) {
        var b = Function._validateParams(arguments, [{ name: "rect", type: SuperMap.Web.Core.Rectangle }]);
        if (b) {
            throw b;
        }
        if (!a) {
            return;
        }
        if (!this.leftTop) {
            this.leftTop = new SuperMap.Web.Core.Point();
        }
        if (!this.rightBottom) {
            this.rightBottom = new SuperMap.Web.Core.Point();
        }
        this.leftTop.copy(a.leftTop);
        this.rightBottom.copy(a.rightBottom);
    },
    center: function() {
        if ((!this.leftTop.x && this.leftTop.x != 0) || (!this.rightBottom.x && this.rightBottom.x != 0) || (!this.leftTop.y && this.leftTop.y != 0) || (!this.rightBottom.y && this.rightBottom.y != 0)) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle_Center_VariableIllegal"));
        }
        return new SuperMap.Web.Core.Point(0.5 * (this.leftTop.x + this.rightBottom.x), 0.5 * (this.leftTop.y + this.rightBottom.y));
    },
    width: function() {
        if ((!this.rightBottom.x && this.rightBottom.x != 0) || (!this.leftTop.x && this.leftTop.x != 0)) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle_Width_VariableIllegal"));
        }
        return Math.abs(this.rightBottom.x - this.leftTop.x);
    },
    height: function() {
        if ((!this.rightBottom.y && this.rightBottom.y != 0) || (!this.leftTop.y && this.leftTop.y != 0)) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle_Height_VariableIllegal"));
        }
        return Math.abs(this.rightBottom.y - this.leftTop.y);
    },
    equals: function(b) {
        var a = false;
        if (b != null) {
            a = this.rightBottom.equals(b.rightBottom) && this.leftTop.equals(b.leftTop);
        }
        return a;
    },
    isEmpty: function() {
        if (this.leftTop.isEmpty() || this.rightBottom.isEmpty()) {
            return true;
        } else {
            return false;
        }
    },
    contains: function(a, b) { return (this.leftTop.x <= a) && (a <= this.rightBottom.x) && (this.leftTop.y <= b) && (b <= this.rightBottom.y); },
    union: function(a) {
        if (a.isEmpty()) {
            return;
        }
        if (this.isEmpty()) {
            this.leftTop.x = a.leftTop.x;
            this.leftTop.y = a.leftTop.y;
            this.rightBottom.x = a.rightBottom.x;
            this.rightBottom.y = a.rightBottom.y;
        } else {
            this.leftTop.x = Math.min(this.leftTop.x, a.leftTop.x);
            this.leftTop.y = Math.min(this.leftTop.y, a.leftTop.y);
            this.rightBottom.x = Math.max(this.rightBottom.x, a.rightBottom.x);
            this.rightBottom.y = Math.max(this.rightBottom.y, a.rightBottom.y);
        }
    }
};
SuperMap.Web.Core.Rectangle.fromJson = function(jsonObject) {
    if (!jsonObject) {
        return null;
    }
    var object = jsonObject;
    if (typeof(jsonObject) === "string") {
        object = eval("(" + jsonObject + ")");
    }
    var rect = new SuperMap.Web.Core.Rectangle(object.leftTop.x, object.leftTop.y, object.rightBottom.x, object.rightBottom.y);
    return rect;
};
SuperMap.Web.Core.Rectangle.registerClass("SuperMap.Web.Core.Rectangle");
SuperMap.Web.Core.Rectangle2D = function(d, a, b, c) {
    if (d || a || b || c) {
        if (typeof(d) != "number" || typeof(a) != "number" || typeof(b) != "number" || typeof(c) != "number" || d > b || a > c) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle2D_Constructor_ParamsError"));
        }
    }
    this.leftBottom = new SuperMap.Web.Core.Point2D(d, a);
    this.rightTop = new SuperMap.Web.Core.Point2D(b, c);
};
SuperMap.Web.Core.Rectangle2D.prototype = {
    toString: function() { return "(" + (this.leftBottom ? this.leftBottom.toString() : "null") + ", " + (this.rightTop ? this.rightTop.toString() : "null") + ")"; },
    clone: function() { return new SuperMap.Web.Core.Rectangle2D(this.leftBottom.x, this.leftBottom.y, this.rightTop.x, this.rightTop.y); },
    copy: function(a) {
        var b = Function._validateParams(arguments, [{ name: "rect2D", type: SuperMap.Web.Core.Rectangle2D }]);
        if (b) {
            throw b;
        }
        if (!this.leftBottom) {
            this.leftBottom = new SuperMap.Web.Core.Point2D();
        }
        if (!this.rightTop) {
            this.rightTop = new SuperMap.Web.Core.Point2D();
        }
        this.leftBottom.copy(a.leftBottom);
        this.rightTop.copy(a.rightTop);
    },
    center: function() {
        if ((!this.leftBottom.x && this.leftBottom.x != 0) || (!this.rightTop.x && this.rightTop.x != 0) || (!this.leftBottom.y && this.leftBottom.y != 0) || (!this.rightTop.y && this.rightTop.y != 0)) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle2D_Center_VariableIllegal"));
        }
        return new SuperMap.Web.Core.Point2D(0.5 * (this.leftBottom.x + this.rightTop.x), 0.5 * (this.leftBottom.y + this.rightTop.y));
    },
    width: function() {
        if ((!this.rightTop.x && this.rightTop.x != 0) || (!this.leftBottom.x && this.leftBottom.x != 0)) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle2D_Width_VariableIllegal"));
        }
        return this.rightTop.x - this.leftBottom.x;
    },
    height: function() {
        if ((!this.rightTop.y && this.rightTop.y != 0) || (!this.leftBottom.y && this.leftBottom.y != 0)) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Core.Resources", "Rectangle2D_Height_VariableIllegal"));
        }
        return this.rightTop.y - this.leftBottom.y;
    },
    equals: function(b) {
        var a = false;
        if (b != null) {
            a = this.leftBottom.equals(b.leftBottom) && this.rightTop.equals(b.rightTop);
        }
        return a;
    },
    isEmpty: function() {
        if (this.leftBottom.isEmpty() || this.rightTop.isEmpty()) {
            return true;
        } else {
            return false;
        }
    },
    contains: function(a, b) { return (this.leftBottom.x <= a) && (a <= this.rightTop.x) && (this.leftBottom.y <= b) && (b <= this.rightTop.y); },
    union: function(a) {
        if (a.isEmpty()) {
            return;
        }
        if (this.isEmpty()) {
            this.leftBottom.x = a.leftBottom.x;
            this.leftBottom.y = a.leftBottom.y;
            this.rightTop.x = a.rightTop.x;
            this.rightTop.y = a.rightTop.y;
        } else {
            this.leftBottom.x = Math.min(this.leftBottom.x, a.leftBottom.x);
            this.leftBottom.y = Math.min(this.leftBottom.y, a.leftBottom.y);
            this.rightTop.x = Math.max(this.rightTop.x, a.rightTop.x);
            this.rightTop.y = Math.max(this.rightTop.y, a.rightTop.y);
        }
    },
    intersect: function(b) {
        var a = new SuperMap.Web.Core.Rectangle2D();
        a.leftBottom.x = Math.max(this.leftBottom.x, b.leftBottom.x);
        a.leftBottom.y = Math.max(this.leftBottom.y, b.leftBottom.y);
        a.rightTop.x = Math.min(this.rightTop.x, b.rightTop.x);
        a.rightTop.y = Math.min(this.rightTop.y, b.rightTop.y);
        return a;
    }
};
SuperMap.Web.Core.Rectangle2D.fromJson = function(jsonObject) {
    if (!jsonObject) {
        return null;
    }
    var object = jsonObject;
    if (typeof(jsonObject) === "string") {
        object = eval("(" + jsonObject + ")");
    }
    var rect2D = new SuperMap.Web.Core.Rectangle2D(object.leftBottom.x, object.leftBottom.y, object.rightTop.x, object.rightTop.y);
    return rect2D;
};
SuperMap.Web.Core.Rectangle2D.registerClass("SuperMap.Web.Core.Rectangle2D");
SuperMap.Web.Core.CoordinateReferenceSystem = function(b, a) {
    if (b && typeof(b) != "number") {
        return false;
    }
    if (a && typeof(a) != "number") {
        return false;
    }
    if (typeof(b) == "undefined") {
        this.wkid = 0;
    } else {
        this.wkid = b;
    }
    if (typeof(a) == "undefined") {
        this.unit = -1;
    } else {
        this.unit = a;
    }
};
SuperMap.Web.Core.CoordinateReferenceSystem.prototype = {
    clone: function() { return new SuperMap.Web.Core.CoordinateReferenceSystem(this.wkid, this.unit); },
    equals: function(a) {
        var b = Function._validateParams(arguments, [{ name: "other", type: SuperMap.Web.Core.CoordinateReferenceSystem }]);
        if (b) {
            throw b;
        }
        if (a.wkid == this.wkid) {
            return true;
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.CoordinateReferenceSystem.registerClass("SuperMap.Web.Core.CoordinateReferenceSystem");
SuperMap.Web.Core.Units = function() {
    this.meter = 10000;
    this.kilometer = 10000000;
    this.mile = 16090000;
    this.yard = 9144;
    this.degree = 1001745329;
    this.millimeter = 10;
    this.centimeter = 100;
    this.inch = 254;
    this.decimeter = 1000;
    this.foot = 3048;
    this.second = 1000000485;
    this.minute = 1000029089;
    this.radian = 1100000000;
};
SuperMap.Web.Core.Units.registerClass("SuperMap.Web.Core.Units");
SuperMap.Web.Core.Feature = function() {
    this.id = null;
    this.title = null;
    this.caption = "";
    this.geometry = new SuperMap.Web.Core.Geometry();
    this.style = new SuperMap.Web.Core.Style();
    this.attributes = new Object();
};
SuperMap.Web.Core.Feature.prototype = {
    clone: function() {
        var a = new SuperMap.Web.Core.Feature();
        a.id = this.id;
        if (this.geometry != null) {
            a.geometry = this.geometry.clone();
        }
        a.title = this.title;
        a.caption = this.caption;
        a.style = this.style;
        a.attributes = this.attributes;
        return a;
    }
};
SuperMap.Web.Core.Feature.registerClass("SuperMap.Web.Core.Feature");
SuperMap.Web.Core.Style = function() {
    this.pointRadius = 6;
    this.stroke = true;
    this.fill = true;
    this.strokeColor = "green";
    this.lineWidth = 2;
    this.lineCap = new Object();
    this.dashStyle = null;
    this.lineJoin = null;
    this.fillColor = "red";
    this.opacity = 1;
};
SuperMap.Web.Core.Style.registerClass("SuperMap.Web.Core.Style");
SuperMap.Web.Core.Geometry = function() {
};
SuperMap.Web.Core.Geometry.prototype = { clone: function() { return null; } };
SuperMap.Web.Core.Geometry.registerClass("SuperMap.Web.Core.Geometry");
SuperMap.Web.Core.GeoPoint = function(a) {
    SuperMap.Web.Core.GeoPoint.initializeBase(this);
    if (a) {
        if (a.x == 0 || a.x) {
            this.x = a.x;
        } else {
            this.x = NaN;
        }
        if (a.y == 0 || a.y) {
            this.y = a.y;
        } else {
            this.y = NaN;
        }
    } else {
        this.x = NaN;
        this.y = NaN;
    }
};
SuperMap.Web.Core.GeoPoint.prototype = {
    bounds: function() {
        if (!isNaN(this.x) && !isNaN(this.y)) {
            return new SuperMap.Web.Core.Rectangle2D(this.x, this.y, this.x, this.y);
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.GeoPoint.registerClass("SuperMap.Web.Core.GeoPoint", SuperMap.Web.Core.Geometry);
SuperMap.Web.Core.GeoLine = function() {
    SuperMap.Web.Core.GeoLine.initializeBase(this);
    this.parts = new Array();
};
SuperMap.Web.Core.GeoLine.prototype = {
    bounds: function() {
        var f, e, d, a;
        for (var c = 0; c < this.parts.length; c++) {
            for (var b = 0; b < this.parts[c].length; b++) {
                if (!f || f > this.parts[c][b].x) {
                    f = this.parts[c][b].x;
                }
                if (!e || e < this.parts[c][b].y) {
                    e = this.parts[c][b].y;
                }
                if (!d || d < this.parts[c][b].x) {
                    d = this.parts[c][b].x;
                }
                if (!a || a > this.parts[c][b].y) {
                    a = this.parts[c][b].y;
                }
            }
        }
        if (!isNaN(f) && !isNaN(e) && !isNaN(d) && !isNaN(a)) {
            return new SuperMap.Web.Core.Rectangle2D(f, a, d, e);
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.GeoLine.registerClass("SuperMap.Web.Core.GeoLine", SuperMap.Web.Core.Geometry);
SuperMap.Web.Core.GeoRegion = function() {
    SuperMap.Web.Core.GeoRegion.initializeBase(this);
    this.parts = new Array();
};
SuperMap.Web.Core.GeoRegion.prototype = {
    bounds: function() {
        var f, e, d, a;
        for (var c = 0; c < this.parts.length; c++) {
            for (var b = 0; b < this.parts[c].length; b++) {
                if (!f || f > this.parts[c][b].x) {
                    f = this.parts[c][b].x;
                }
                if (!e || e < this.parts[c][b].y) {
                    e = this.parts[c][b].y;
                }
                if (!d || d < this.parts[c][b].x) {
                    d = this.parts[c][b].x;
                }
                if (!a || a > this.parts[c][b].y) {
                    a = this.parts[c][b].y;
                }
            }
        }
        if (!isNaN(f) && !isNaN(e) && !isNaN(d) && !isNaN(a)) {
            return new SuperMap.Web.Core.Rectangle2D(f, a, d, e);
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.GeoRegion.registerClass("SuperMap.Web.Core.GeoRegion", SuperMap.Web.Core.Geometry);
SuperMap.Web.Core.GeoEllipse = function(a, b, c) {
    SuperMap.Web.Core.GeoEllipse.initializeBase(this);
    if (SuperMap.Web.Core.Point2D.isInstanceOfType(a)) {
        this.center = a;
    }
    this.xGeoRadius = b ? b : 0;
    this.yGeoRadius = c ? c : 0;
};
SuperMap.Web.Core.GeoEllipse.prototype = {
    bounds: function() {
        if (!isNaN(this.center.x) && !isNaN(this.center.y)) {
            return new SuperMap.Web.Core.Rectangle2D(this.center.x - this.xGeoRadius, this.center.y - this.yGeoRadius, this.center.x + this.xGeoRadius, this.center.y + this.yGeoRadius);
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.GeoEllipse.registerClass("SuperMap.Web.Core.GeoEllipse", SuperMap.Web.Core.Geometry);
SuperMap.Web.Core.GeoCircle = function(a, b) {
    SuperMap.Web.Core.GeoCircle.initializeBase(this);
    if (SuperMap.Web.Core.Point2D.isInstanceOfType(a)) {
        this.center = a;
    }
    this.geoRadius = b ? b : 0;
};
SuperMap.Web.Core.GeoCircle.prototype = {
    bounds: function() {
        if (!isNaN(this.center.x) && !isNaN(this.center.y)) {
            return new SuperMap.Web.Core.Rectangle2D(this.center.x - this.geoRadius, this.center.y - this.geoRadius, this.center.x + this.geoRadius, this.center.y + this.geoRadius);
        } else {
            return false;
        }
    }
};
SuperMap.Web.Core.GeoCircle.registerClass("SuperMap.Web.Core.GeoCircle", SuperMap.Web.Core.Geometry);
SuperMap.Web.Core.Marker = function(a) {
    var b = Function._validateParams(arguments, [{ name: "container", domElement: true }]);
    if (b) {
        throw b;
    }
    SuperMap.Web.Core.Marker.initializeBase(this, [a]);
    this._id = null;
    this._x = NaN;
    this._y = NaN;
    this._offsetX = 0;
    this._offsetY = 0;
    this._title = null;
    this._info = null;
    this._oldPosition = new Object();
    this.isAdded = false;
};
SuperMap.Web.Core.Marker.prototype = {
    get_id: function() { return this._id; },
    set_id: function(a) { this._id = a; },
    get_x: function() { return this._x; },
    set_x: function(a) {
        var b = Function._validateParams(arguments, [{ name: "x", type: Number }]);
        if (b) {
            throw b;
        }
        this._x = a;
    },
    get_y: function() { return this._y; },
    set_y: function(b) {
        var a = Function._validateParams(arguments, [{ name: "x", type: Number }]);
        if (a) {
            throw a;
        }
        this._y = b;
    },
    get_title: function() { return this._title; },
    set_title: function(b) {
        var a = Function._validateParams(arguments, [{ name: "info", type: String }]);
        if (a) {
            throw a;
        }
        this._title = b;
        this._element.title = this._title;
    },
    get_offsetX: function() { return this._offsetX; },
    set_offsetX: function(a) {
        var b = Function._validateParams(arguments, [{ name: "offsetX", type: Number }]);
        if (b) {
            throw b;
        }
        this._offsetX = a;
    },
    get_offsetY: function() { return this._offsetY; },
    set_offsetY: function(b) {
        var a = Function._validateParams(arguments, [{ name: "offsetY", type: Number }]);
        if (a) {
            throw a;
        }
        this._offsetY = b;
    },
    get_info: function() { return this._info; },
    set_info: function(b) {
        var a = Function._validateParams(arguments, [{ name: "info", type: String }]);
        if (a) {
            throw a;
        }
        this._info = b;
    },
    dispose: function() {
        if (this._element && this._element.parentNode) {
            $clearHandlers(this._element);
            this._element.parentNode.removeChild(this._element);
            delete this._element;
        }
    },
    initialize: function() {
        if (this._title != null) {
            this._element.title = this._title;
        }
        this._clickDelegate = Function.createDelegate(this, this._click);
        $addHandler(this._element, "click", this._clickDelegate);
        this._dblClickDelegate = Function.createDelegate(this, this._dblClick);
        $addHandler(this._element, "dblclick", this._dblClickDelegate);
        this._mouseOverDelegate = Function.createDelegate(this, this._mouseOver);
        $addHandler(this._element, "mouseover", this._mouseOverDelegate);
        this._mouseOutClickDelegate = Function.createDelegate(this, this._mouseOut);
        $addHandler(this._element, "mouseout", this._mouseOutClickDelegate);
        this._mouseDownDelegate = Function.createDelegate(this, this._mouseDown);
        $addHandler(this._element, "mousedown", this._mouseDownDelegate);
        this._mouseUpDelegate = Function.createDelegate(this, this._mouseUp);
        $addHandler(this._element, "mouseup", this._mouseUpDelegate);
    },
    show: function() { this._element.style.display = ""; },
    hide: function() { this._element.style.display = "none"; },
    isHidden: function() { return this._element.style.display === "none"; },
    remove: function() {
        this._element.parentNode.removeChild(this._element);
        this.raise_removed();
    },
    _click: function(b) {
        b = SuperMap.Web.Utility.getEvent(b);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            b.stopPropagation();
        }
        var c = SuperMap.Web.Utility.getMouseX(b);
        var a = SuperMap.Web.Utility.getMouseY(b);
        if (c != this._oldPosition.x && a != this._oldPosition.y) {
            return false;
        }
        this.raise_click(this);
    },
    _dblClick: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            a.stopPropagation();
        }
        this.raise_dblClick(this);
    },
    _mouseOver: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            a.stopPropagation();
        }
        this.raise_mouseOver(this);
    },
    _mouseOut: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            a.stopPropagation();
        }
        this.raise_mouseOut(this);
    },
    _mouseDown: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            a.stopPropagation();
        }
        this._oldPosition.x = SuperMap.Web.Utility.getMouseX(a);
        this._oldPosition.y = SuperMap.Web.Utility.getMouseY(a);
        this.raise_mouseDown(this);
    },
    _mouseUp: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            a.stopPropagation();
        }
        this.raise_mouseUp(this);
    },
    _mouseMove: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            window.event.cancelBubble = true;
        } else {
            a.stopPropagation();
        }
        this.raise_mouseMove(this);
    },
    add_removed: function(a) { this._addEvent("removed", a); },
    remove_removed: function(a) { this._removeEvent("removed", a); },
    raise_removed: function(a, b) { this._raiseEvent("removed", a, b); },
    add_click: function(a) { this._addEvent("click", a); },
    remove_click: function(a) { this._removeEvent("click", a); },
    raise_click: function(a, b) { this._raiseEvent("click", a, b); },
    add_dblClick: function(a) { this._addEvent("dblClick", a); },
    remove_dblClick: function(a) { this._removeEvent("dblClick", a); },
    raise_dblClick: function(a, b) { this._raiseEvent("dblClick", a, b); },
    add_mouseOver: function(a) { this._addEvent("mouseOver", a); },
    remove_mouseOver: function(a) { this._removeEvent("mouseOver", a); },
    raise_mouseOver: function(a, b) { this._raiseEvent("mouseOver", a, b); },
    add_mouseOut: function(a) { this._addEvent("mouseOut", a); },
    remove_mouseOut: function(a) { this._removeEvent("mouseOut", a); },
    raise_mouseOut: function(a, b) { this._raiseEvent("mouseOut", a, b); },
    add_mouseDown: function(a) { this._addEvent("mouseDown", a); },
    remove_mouseDown: function(a) { this._removeEvent("mouseDown", a); },
    raise_mouseDown: function(a, b) { this._raiseEvent("mouseDown", a, b); },
    add_mouseUp: function(a) { this._addEvent("mouseUp", a); },
    remove_mouseUp: function(a) { this._removeEvent("mouseUp", a); },
    raise_mouseUp: function(a, b) { this._raiseEvent("mouseUp", a, b); },
    _addEvent: function(a, b) { this.get_events().addHandler(a, b); },
    _removeEvent: function(a, b) { this.get_events().removeHandler(a, b); },
    _raiseEvent: function(a, b, d) {
        var c = this.get_events().getHandler(a);
        if (c) {
            c(b, d);
        }
    }
};
SuperMap.Web.Core.Marker.registerClass("SuperMap.Web.Core.Marker", Sys.UI.Control, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Core");
SuperMap.Web.Core.Resources = function() {
};
SuperMap.Web.Core.Resources.zh_cn = { Point_Constructor_ParamsError: "创建点对象传入参数必须为number类型。", Point2D_Constructor_ParamsError: "创建点对象传入参数必须为number类型。", Rectangle_Constructor_ParamsError: "创建矩形对象参数不符合要求，参数类型必须都为'number'类型，并且左值要小于右值，上值要小于下值。", Rectangle_Center_VariableIllegal: "计算矩形中心点所需变量值不全。", Rectangle_Width_VariableIllegal: "计算矩形宽度所需变量值不全", Rectangle_Height_VariableIllegal: "计算矩形高度所需变量值不全。", Rectangle2D_Constructor_ParamsError: "创建矩形对象参数不符合要求，参数类型必须都为'number'类型，并且左值要小于右值，下值要小于上值。", Rectangle2D_Center_VariableIllegal: "计算矩形中心点所需变量值不全。", Rectangle2D_Width_VariableIllegal: "计算矩形宽度所需变量值不全", Rectangle2D_Height_VariableIllegal: "计算矩形高度所需变量值不全。", CoordinateReferenceSystem_SetWkid_ParamsError: "坐标参考系的属性Wkid的类型必须为number型。", CoordinateReferenceSystem_SetUnit_ParamsError: "坐标参考系的属性Unit的类型必须为String型。" };
SuperMap.Web.Core.Resources.registerClass("SuperMap.Web.Core.Resources");
Type.registerNamespace("SuperMap.Web.Theme");
SuperMap.Web.Theme.Theme = function() {
    SuperMap.Web.Theme.Theme.initializeBase(this);
    this._fill;
    this._stroke;
    this._strokeThickness;
    this._opacity;
    this._size;
    this._color;
    this._hoverVertexStyle;
    this._hoverLineStyle;
    this._snapStyle;
};
SuperMap.Web.Theme.Theme.prototype = { get_fill: function() { return this._fill; }, set_fill: function(a) { this._fill = a; }, get_stroke: function() { return this._stroke; }, set_stroke: function(a) { this._stroke = a; }, get_strokeThickness: function() { return this._strokeThickness; }, set_strokeThickness: function(a) { this._strokeThickness = a; }, get_opacity: function() { return this._opacity; }, set_opacity: function(a) { this._opacity = a; }, get_size: function() { return this._size; }, set_size: function(a) { this._size = a; }, get_color: function() { return this._color; }, set_color: function(a) { this._color = a; }, get_hoverVertexStyle: function() { return this._hoverVertexStyle; }, set_hoverVertexStyle: function(a) { this._hoverVertexStyle = a; }, get_hoverLineStyle: function() { return this._hoverLineStyle; }, set_hoverLineStyle: function(a) { this._hoverLineStyle = a; }, get_snapStyle: function() { return this._snapStyle; }, set_snapStyle: function(a) { this._snapStyle = a; } };
SuperMap.Web.Theme.Theme.registerClass("SuperMap.Web.Theme.Theme", Sys.Component, Sys.IDisposable);
SuperMap.Web.Theme.RawTheme = function() {
    SuperMap.Web.Theme.RawTheme.initializeBase(this);
    this._fill = "#4272d7";
    this._stroke = "#5082e5";
    this._strokeThickness = 2;
    this._opacity = 0.5;
    this._size = 2;
    this._color = "#4272d7";
    this._hoverVertexStyle = new SuperMap.Web.Core.Style();
    this._hoverVertexStyle.fill = true;
    this._hoverVertexStyle.stroke = true;
    this._hoverVertexStyle.fillColor = "#c7c1c1";
    this._hoverVertexStyle.strokeColor = "#7d899f";
    this._hoverVertexStyle.pointRadius = 5;
    this._hoverVertexStyle.lineWidth = 2;
    this._hoverLineStyle = new SuperMap.Web.Core.Style();
    this._hoverLineStyle.stroke = true;
    this._hoverLineStyle.strokeColor = "#5082e5";
    this._hoverLineStyle.lineWidth = 2;
    this._snapStyle = new SuperMap.Web.Core.Style();
    this._snapStyle.fill = true;
    this._snapStyle.stroke = true;
    this._snapStyle.fillColor = "#d8d5d5";
    this._snapStyle.strokeColor = "#48b366";
    this._snapStyle.pointRadius = 6;
    this._snapStyle.lineWidth = 2;
};
SuperMap.Web.Theme.RawTheme.prototype = { get_fill: function() { return this._fill; }, get_stroke: function() { return this._stroke; }, get_strokeThickness: function() { return this._strokeThickness; }, get_opacity: function() { return this._opacity; }, get_size: function() { return this._size; }, get_color: function() { return this._color; }, get_hoverVertexStyle: function() { return this._hoverVertexStyle; }, get_hoverLineStyle: function() { return this._hoverLineStyle; }, get_snapStyle: function() { return this._snapStyle; } };
SuperMap.Web.Theme.RawTheme.registerClass("SuperMap.Web.Theme.RawTheme", SuperMap.Web.Theme.Theme, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.Map = function(a) {
    var b = Function._validateParams(arguments, [{ name: "container", domElement: true }]);
    if (b) {
        throw b;
    }
    SuperMap.Web.Mapping.Map.initializeBase(this, [a]);
    this._id = a.id;
    this._action = $create(SuperMap.Web.Actions.Pan, { map: this }, null, null, null);
    if (Sys.Browser.name == "Microsoft Internet Explorer") {
        this._width = this._element.offsetWidth;
        this._height = this._element.offsetHeight;
    } else {
        this._width = this._element.clientWidth;
        this._height = this._element.clientHeight;
    }
    this._originX = null;
    this._originY = null;
    this._isZooming = false;
    this._x = 0;
    this._y = 0;
    this._mousePosition = new Object();
    this._mousePosition.mapCoord = new SuperMap.Web.Core.Point2D();
    this._mousePosition.pixelCoord = new SuperMap.Web.Core.Point();
    this._showMousePosition = false;
    this._panningX = 0;
    this._panningY = 0;
    this._keyboardPanDistance = 30;
    this._panStepDistance = 15;
    if (Sys.Browser.name != "Microsoft Internet Explorer") {
        this._zoomTotalSteps = 3;
        this._keyboardPanDistance = 45;
        this._panStepDistance = 45;
    }
    this._zoomInRatio = 1.5;
    this._zoomOutRatio = 0.5;
    this._panDistanceX = 0;
    this._panDistanceY = 0;
    this._isPanning = false;
    this._layerTemp = new Array();
    this._isStartWheel = false;
    this._layerCollection = new SuperMap.Web.Mapping.Layers();
    this._dpi = null;
    this._viewBounds = null;
    this._lastViewBounds = null;
    this._bounds = null;
    this._scales = null;
    this._resolutions = new Array();
    this._innerResolutions = new Array();
    this._resolution = null;
    this._crs = null;
    this._panActionMark = false;
    this._tempMarkLayer = null;
    this._restrictedBounds = null;
    this._infoWindow = new SuperMap.Web.Mapping.InfoWindow({ map: this }, true);
    this._baseLayer = null;
    this._baseLayerInitialized = false;
    this._userDefineBaseLayer = false;
    this._theme = null;
    this._controls = [];
    this._regWinResize();
};
SuperMap.Web.Mapping.Map.prototype = {
    get_id: function() { return this._id; },
    get_originX: function() { return this._originX; },
    get_originY: function() { return this._originY; },
    get_isZooming: function() { return this._isZooming; },
    get_isPanning: function() { return this._isPanning; },
    get_action: function() { return this._action; },
    set_action: function(a) {
        if (a != null) {
            var b = Function._validateParams(arguments, [{ name: "action", type: SuperMap.Web.Actions.MapAction }]);
            if (b) {
                if (SuperMap.Web.Utility.isDebug) {
                    console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.UI.Resources", "Map_setAction_parameterError"));
                }
                return false;
            }
        }
        if (this._action) {
            this._action.dispose();
        }
        this._action = a;
        this.raise_actionChanged();
    },
    get_width: function() { return this._width; },
    get_height: function() { return this._height; },
    get_mapDiv: function() { return this._mapDiv; },
    get_mousePosition: function() { return this._mousePosition; },
    get_viewBounds: function() { return this._viewBounds; },
    set_viewBounds: function(a) {
        var b = Function._validateParams(arguments, [{ name: "viewBounds", type: SuperMap.Web.Core.Rectangle2D }]);
        if (b) {
            throw b;
        }
        a = this._panRange(a);
        this._rectify(a);
        this.raise_viewBoundsChanged();
    },
    get_scales: function() { return this._scales; },
    set_scales: function(d) {
        var c = Function._validateParams(arguments, [{ name: "scales", type: Array }]);
        if (c) {
            throw c;
        }
        this._scales = SuperMap.Web.Utility.arraySortAsc(d);
        if (this._dpi) {
            if (this._resolutions.length > 0) {
                this._resolutions = new Array();
            }
            for (var b = 0; b < this._scales.length; b++) {
                var a = 0.0254 / this._dpi / this._scales[b];
                this._resolutions.push(a);
            }
        }
        this._innerResolutions = this._resolutions.slice(0);
    },
    get_crs: function() { return this._crs; },
    set_crs: function(a) {
        var b = Function._validateParams(arguments, [{ name: "crs", type: SuperMap.Web.Core.CoordinateReferenceSystem }]);
        if (b) {
            throw b;
        }
        this._crs = a;
    },
    get_restrictedBounds: function() { return this._restrictedBounds; },
    set_restrictedBounds: function(b) {
        var a = Function._validateParams(arguments, [{ name: "restrictedBounds", type: SuperMap.Web.Core.Rectangle2D }]);
        if (a) {
            throw a;
        }
        this._restrictedBounds = b;
    },
    get_resolution: function() { return this._resolution; },
    get_resolutions: function() { return this._resolutions; },
    get_innerResolutions: function() { return this._innerResolutions; },
    set_resolutions: function(a) {
        this._resolutions = a;
        this._innerResolutions = this._resolutions.slice(0);
    },
    get_scale: function() {
        if (!!this._scales && this._scales.length > 0) {
            return this._scales[this.get_level()];
        } else {
            if (this._dpi != null && this._resolution != null) {
                return 0.0254 / this._dpi / this._resolution;
            } else {
                return false;
            }
        }
    },
    get_level: function() {
        if (this._innerResolutions != null && this._innerResolutions.length > 0 && this._resolution != null) {
            for (var a = 0; a < this._innerResolutions.length; a++) {
                if (this._innerResolutions[a] == this._resolution) {
                    return a;
                }
            }
            return -1;
        } else {
            if (SuperMap.Web.Utility.isDebug) {
                console.warn(SuperMap.Web.Resources.Resource.getMessage("no level!"));
            }
            return -1;
        }
    },
    get_lastViewBounds: function() { return this._lastViewBounds; },
    get_center: function() { return this._viewBounds.center(); },
    get_bounds: function() { return this._bounds; },
    get_infoWindow: function() { return this._infoWindow; },
    get_logo: function() { return this._logo; },
    __set_dpi: function(a) { this._dpi = a; },
    get_theme: function() { return this._theme; },
    set_theme: function(a) { this._theme = a; },
    dispose: function() {
        if (!this._element) {
            return null;
        }
        this._element.removeChild(this._workLayer);
        this._mapDiv = null;
        this._workLayer = null;
        $removeHandler(this._element, "mousedown", this._mouseDownDelegate);
        $removeHandler(this._element, "mousedown", this._mouseDownDelegate);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            $removeHandler(this._element, "mouseup", this._mouseUpDelegate);
        }
        $removeHandler(this._element, "mousemove", this._mouseMoveDelegate);
        if (document.removeEventListener) {
            this._element.removeEventListener("DOMMouseScroll", this._mouseScrollDelegate, true);
        }
        $removeHandler(this._element, "mousewheel", this._mouseWheelDelegate);
        $removeHandler(this._element, "dblclick", this._dblClickDelegate);
        $removeHandler(this._element, "contextmenu", this._contextMenuDelegate);
        $removeHandler(this._element, "click", this._clickDelegate);
        $removeHandler(this._kbInput, "keydown", this._keyDownDelegate);
        $removeHandler(this._kbInput, "keyup", this._keyUpDelegate);
        this._element = null;
        this._infoWindow = null;
        this._compass = null;
        this._scaleBar = null;
        this._logo = null;
        this._mousePosition.mapCoord = null;
        this._mousePosition.pixelCoord = null;
        this._mousePosition = null;
        this._layerTemp = null;
        this._layerCollection = null;
        this._resolutions = null;
        this._innerResolutions = null;
    },
    initialize: function() {
        this._setLayout();
        this._createMousePositionDiv();
        this._createDeleFunction();
        this._bindEvent();
        this.add_sizeChanged(this._resizeDelegate);
    },
    addControls: function(b) {
        for (var c = 0, a = b.length; c < a; c++) {
            var d = b[c];
            this.addControl(d);
        }
    },
    addControl: function(e) {
        var d = false;
        for (var b = 0, a = this._controls.length; b < a; b++) {
            var c = this._controls[b];
            if (c._id == e._id) {
                d = true;
                break;
            }
        }
        if (!d) {
            this._controls.push(e);
            e.initialize(this);
        }
    },
    getControl: function(e) {
        var b = null;
        for (var c = 0, a = this._controls.length; c < a; c++) {
            var d = this._controls[c];
            if (d._id == e) {
                b = d;
                break;
            }
        }
        return b;
    },
    removeControl: function(d) {
        for (var b = 0, a = this._controls.length; b < a; b++) {
            var c = this._controls[b];
            if (c._id == d) {
                c.dispose();
                this._controls.splice(b, 1);
                break;
            }
        }
    },
    addLayer: function(a) {
        var b = Function._validateParams(arguments, [{ name: "layer", type: SuperMap.Web.Mapping.Layer }]);
        if (b) {
            throw b;
        }
        this._layerTemp.push(a);
        if (!this._baseLayer) {
            this._baseLayer = a;
            if (a._isBaseLayer != true) {
                a._isBaseLayer = true;
            } else {
                this._userDefineBaselayer = true;
            }
        } else {
            if (a._isBaseLayer == true && this._userDefineBaselayer == false) {
                this._baseLayer._isBaseLayer = false;
                this._baseLayer = a;
                this._userDefineBaselayer = true;
            }
        }
        a.add_initialized(this._layerCompleteDelegate);
        if (a.get_isInitialized()) {
            this._layerComplete(a);
        }
    },
    setLayers: function(d) {
        var c = Function._validateParams(arguments, [{ name: "layers", type: Array }]);
        if (c) {
            throw c;
        }
        var b = d.length;
        for (var a = 0; a < b; a++) {
            this.addLayer(d[a]);
        }
    },
    openInfoWindow: function(a, c, b) {
        this._infoWindow.setCaption(c);
        this._infoWindow.setContent(b);
        this._infoWindow.show(a);
    },
    openInfoWindowByAnchor: function(a, e, c, b, d) {
        this._infoWindow.setCaption(e);
        this._infoWindow.setContent(c);
        this._infoWindow.show(a, b, d);
    },
    closeInfoWindow: function() { this._infoWindow.hide(); },
    pan: function(b, d) {
        var c = Function._validateParams(arguments, [{ name: "offsetX", type: Number }, { name: "offsetY", type: Number }]);
        if (c) {
            throw c;
        }
        if (isNaN(b) || isNaN(d)) {
            return;
        }
        if (!!this._viewBounds) {
            var a = this._viewBounds.center();
            this.panTo(new SuperMap.Web.Core.Point2D(a.x + b, a.y + d));
        }
    },
    panByPixel: function(b, a) {
        var c = Function._validateParams(arguments, [{ name: "pixelX", type: Number }, { name: "pixelY", type: Number }]);
        if (c) {
            throw c;
        }
        this.pan(b * this._resolution, a * this._resolution * -1);
    },
    panTo: function(a) {
        this._isPanning = true;
        var f = Function._validateParams(arguments, [{ name: "center", type: SuperMap.Web.Core.Point2D }]);
        if (f) {
            this.set_viewBounds(this._viewBounds);
        } else {
            var b = this._viewBounds.width() / 2;
            var d = this._viewBounds.height() / 2;
            var c = new SuperMap.Web.Core.Rectangle2D(a.x - b, a.y - d, a.x + b, a.y + d);
            this._viewBounds = this._panRange(c);
            this.raise_viewBoundsChanged();
        }
        this._isPanning = false;
    },
    zoom: function(d) {
        var f = Function._validateParams(arguments, [{ name: "ratio", type: Number }]);
        if (f) {
            throw f;
        }
        if (d <= 0) {
            return;
        }
        var a = this._resolution / d;
        if (this._innerResolutions != null && this._innerResolutions.length > 0) {
            for (var c = 0; c < this._innerResolutions.length - 1; c++) {
                if (a <= this._innerResolutions[c] && a >= this._innerResolutions[c + 1]) {
                    var b = a;
                    a = (this._innerResolutions[c] - a) < (a - this._innerResolutions[c + 1]) ? this._innerResolutions[c] : this._innerResolutions[c + 1];
                    break;
                } else {
                    if (a < this._innerResolutions[this._innerResolutions.length - 1]) {
                        a = this._innerResolutions[this._innerResolutions.length - 1];
                        break;
                    } else {
                        if (a > this._innerResolutions[0]) {
                            a = this._innerResolutions[0];
                            break;
                        }
                    }
                }
            }
        }
        this._zoomToResolution(a);
    },
    zoomToLevel: function(c, a) {
        if (typeof(c) != "number" || isNaN(c)) {
            return;
        }
        if (this._innerResolutions != null && this._innerResolutions.length > 0) {
            var b;
            if (c < 0) {
                b = this._innerResolutions[0];
            } else {
                if (c > (this._innerResolutions.length - 1)) {
                    b = this._innerResolutions[this._innerResolutions.length - 1];
                } else {
                    b = this._innerResolutions[c];
                }
            }
        } else {
            throw new Error("map resolutions is null");
        }
        this._zoomToResolution(b, a);
    },
    zoomToScale: function(e, a) {
        if (this._dpi == null) {
            throw new Error("map无dpi!");
        }
        var b = 0.0254 / this._dpi / e;
        if (this._innerResolutions != null && this._innerResolutions.length > 0) {
            for (var d = 0; d < this._innerResolutions.length - 1; d++) {
                if (b <= this._innerResolutions[d] && b >= this._innerResolutions[d + 1]) {
                    var c = b;
                    b = (this._innerResolutions[d] - b) < (b - this._innerResolutions[d + 1]) ? this._innerResolutions[d] : this._innerResolutions[d + 1];
                    break;
                } else {
                    if (b < this._innerResolutions[this._innerResolutions.length - 1]) {
                        b = this._innerResolutions[this._innerResolutions.length - 1];
                        break;
                    } else {
                        if (b > this._innerResolutions[0]) {
                            b = this._innerResolutions[0];
                            break;
                        }
                    }
                }
            }
        }
        this._zoomToResolution(b, a);
    },
    viewEntire: function() {
        if (this._bounds.isEmpty() || this._viewBounds.isEmpty() || !this._resolution) {
            if (SuperMap.Web.Utility.isDebug) {
                console.warn(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "Map_viewEntire_conditionLack"));
            }
            return false;
        }
        var e = this._bounds.width() / this._viewBounds.width();
        var c = this._bounds.height() / this._viewBounds.height();
        var d = e > c ? e : c;
        var b = this._resolution * d;
        var a = this._bounds.center();
        this._zoomToResolution(b, a);
    },
    removeLayer: function(b) {
        if (typeof(b) == "undefined" && this._layerCollection != null) {
            this._layerCollection.remove();
            while (this._layerTemp.length > 0) {
                this._layerTemp.pop();
            }
        } else {
            if (this._layerCollection != null) {
                this._layerCollection.remove(b);
                for (var a = 0; a < this._layerCollection.length(); a++) {
                    if (b === this._layerTemp[a]) {
                        this._layerTemp.splice(a, 1);
                    }
                }
            }
        }
        this.raise_layerRemoved();
    },
    removeLayerById: function(b) {
        if (typeof(b) == "undefined") {
            if (SuperMap.Web.Utility.isDebug) {
                console.error("id is null");
            }
            return false;
        } else {
            this._layerCollection.removeById(b);
            for (var a = 0; a < this._layerTemp.length; a++) {
                if (b == this._layerTemp[a].get_id()) {
                    this._layerTemp.splice(a, 1);
                }
            }
            this.raise_layerRemoved();
        }
    },
    refresh: function() {
        if (this._layerCollection != null && this._layerCollection.length() > 0) {
            for (var a = 0; a < this._layerCollection.length(); a++) {
                this._layerCollection.refresh();
            }
        }
        return;
    },
    resize: function(b, a) {
        this._element.style.width = b + "px";
        this._element.style.height = a + "px";
        this.raise_sizeChanged();
    },
    mapToScreen: function(c) {
        var b = Function._validateParams(arguments, [{ name: "point2D", type: SuperMap.Web.Core.Point2D }]);
        if (b) {
            if (SuperMap.Web.Utility.isDebug) {
                console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "Map_mapToScreen_parameterError"));
            }
            return false;
        }
        if (c.isEmpty() || this._viewBounds == null) {
            return;
        }
        var a = new SuperMap.Web.Core.Point();
        a.x = Math.floor((c.x - this._viewBounds.leftBottom.x) / this._resolution);
        a.y = Math.floor((this._viewBounds.rightTop.y - c.y) / this._resolution);
        return a;
    },
    screenToMap: function(a) {
        var c = Function._validateParams(arguments, [{ name: "point", type: SuperMap.Web.Core.Point }]);
        if (c) {
            if (SuperMap.Web.Utility.isDebug) {
                console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "Map_screenToMap_parameterError"));
            }
            return false;
        }
        if (a.isEmpty() || this._viewBounds == null) {
            return;
        }
        var b = new SuperMap.Web.Core.Point2D();
        b.x = this._viewBounds.leftBottom.x + (a.x * this._resolution);
        b.y = this._viewBounds.rightTop.y - (a.y * this._resolution);
        return b;
    },
    getUnit: function() {
        var b = this.get_crs();
        var a = new SuperMap.Web.Core.Units();
        switch (b.unit) {
        case a.meter:
            return "meter";
            break;
        case a.kilometer:
            return "kilometer";
            break;
        case a.mile:
            return "mile";
            break;
        case a.yard:
            return "yard";
            break;
        case a.degree:
            return "degree";
            break;
        case a.millimeter:
            return "millimeter";
            break;
        case a.centimeter:
            return "centimeter";
            break;
        case a.inch:
            return "inch";
            break;
        case a.decimeter:
            return "decimeter";
            break;
        case a.foot:
            return "foot";
            break;
        case a.second:
            return "second";
            break;
        case a.minute:
            return "minute";
            break;
        case a.radian:
            return "radian";
            break;
        default:
            return "??";
        }
    },
    _setLayout: function() {
        this._workLayer = document.createElement("div");
        this._workLayer.id = this._id + "_workLayer";
        this._workLayer.style.width = this._width;
        this._workLayer.style.height = this._height;
        this._workLayer.style.overflow = "hidden";
        this._workLayer.style.position = "relative";
        this._element.appendChild(this._workLayer);
        this._getPosition();
        if (this._width < 100) {
            this._element.style.width = "100px";
        }
        if (this._height < 100) {
            this._element.style.height = "100px";
        }
        this._element.style.overflow = "hidden";
        this._element.style.padding = "0px";
        this._element.style.margin = "0px";
        this._mapDiv = document.createElement("div");
        this._mapDiv.id = this._id + "_mapDiv";
        this._mapDiv.style.position = "relative";
        this._mapDiv.style.top = "0px";
        this._mapDiv.style.left = "0px";
        this._mapDiv.style.width = this._width + "px";
        this._mapDiv.style.height = this._height + "px";
        this._mapDiv.style.padding = "0px";
        this._mapDiv.style.margin = "0px";
        this._mapDiv.style.zIndex = 1;
        this._workLayer.appendChild(this._mapDiv);
        this.raise_staticPanelLoaded(this._workLayer);
        this._kbInput = document.createElement("input");
        this._kbInput.id = this._id + "_kbInput";
        this._kbInput.value = "";
        var a = this._kbInput.style;
        a.position = "absolute";
        a.top = this._height / 2 + "px";
        a.left = this._width / 2 + "px";
        a.width = "0px";
        a.height = "0px";
        a.padding = "0px";
        a.margin = "0px";
        a.border = "0px solid white";
        a.zIndex = -1;
        a = null;
        this._workLayer.appendChild(this._kbInput);
    },
    _createMousePositionDiv: function() {
        this._mousePositionDiv = document.createElement("div");
        this._mousePositionDiv.id = "MousePositionDiv";
        this._mousePositionDiv.style.position = "absolute";
        this._mousePositionDiv.style.zIndex = 100;
        this._mousePositionDiv.style.fontWeight = "bold";
        this._mousePositionDiv.style.fontSize = "8pt";
        this._mousePositionDiv.style.right = "10px";
        this._mousePositionDiv.style.bottom = "10px";
        this._mousePositionDiv.style.border = "0px solid red";
        this._mousePositionDiv.innerHTML = "0.00000 0.00000";
    },
    _createDeleFunction: function() {
        this._mouseDownDelegate = Function.createDelegate(this, this._mouseDown);
        this._mouseUpDelegate = Function.createDelegate(this, this._mouseUp);
        this._mouseMoveDelegate = Function.createDelegate(this, this._mouseMove);
        this._mouseWheelDelegate = Function.createDelegate(this, this._mouseWheel);
        this._mouseScrollDelegate = Function.createDelegate(this, this._mouseScroll);
        this._keyDownDelegate = Function.createDelegate(this, this._keyDown);
        this._keyUpDelegate = Function.createDelegate(this, this._keyUp);
        this._contextMenuDelegate = Function.createDelegate(this, this._contextMenu);
        this._clickDelegate = Function.createDelegate(this, this._click);
        this._dblClickDelegate = Function.createDelegate(this, this._dblClick);
        this._mouseOutDelegate = Function.createDelegate(this, this._mouseOut);
        this._controlMouseWheelDelegate = Function.createDelegate(this, this._controlMouseWheel);
        this._resizeDelegate = Function.createDelegate(this, this._resize);
        this._layerCompleteDelegate = Function.createDelegate(this, this._layerComplete);
    },
    _layerComplete: function(c) {
        c.remove_initialized(this._layerCompleteDelegate);
        if (!SuperMap.Web.Mapping.FeaturesLayer || !(SuperMap.Web.Mapping.FeaturesLayer.isInstanceOfType(c))) {
            if (!this._crs) {
                this._crs = new SuperMap.Web.Core.CoordinateReferenceSystem();
            }
            if (this._crs.wkid != c.get_crs().wkid) {
                if (this._crs.wkid != 0) {
                    return;
                } else {
                    if (this._layerCollection.crs().wkid != c.get_crs().wkid) {
                        if (this._layerCollection.crs().wkid != 0) {
                            return;
                        }
                    }
                }
            }
        }
        var a;
        for (var b = 0; b < this._layerTemp.length; b++) {
            if (this._layerTemp[b] == c) {
                a = b;
                break;
            }
        }
        this._pushLayer(c, a);
        if (c._isBaseLayer && c === this._baseLayer) {
            this._baseLayerInitialized = true;
            this.raise_baseLayerInitialized();
        }
    },
    _pushLayer: function(d, b) {
        this._layerCollection.push(d, b);
        this._checkBounds(d);
        if (SuperMap.Web.Mapping.TiledCachedLayer.isInstanceOfType(d)) {
            if (d.get_dpi) {
                this._dpi = d.get_dpi();
            }
            if (this._resolutions.length > 0 || this._scales != null) {
                if (this._resolutions.length == 0) {
                    for (var c = 0; c < this._scales.length; c++) {
                        var a = 0.0254 / this._dpi / this._scales[c];
                        this._resolutions.push(a);
                    }
                }
                this._innerResolutions = this._resolutions.slice(0);
            } else {
                this._innerResolutions = this._innerResolutions.concat(d.get_resolutions().slice(0));
                this._innerResolutions = SuperMap.Web.Utility.arraySortDesc(this._innerResolutions);
                for (var c = this._innerResolutions.length - 1; c > 0; c--) {
                    if (this._innerResolutions[c] == this._innerResolutions[c - 1]) {
                        this._innerResolutions.splice(c, 1);
                    }
                }
            }
            this._mapInit();
        } else {
            if (d.get_dpi) {
                this._dpi = d.get_dpi();
                if (this._resolutions.length > 0) {
                    this._resolutions = new Array();
                }
                if (this._scales != null) {
                    for (var c = 0; c < this._scales.length; c++) {
                        var a = 0.0254 / this._dpi / this._scales[c];
                        this._resolutions.push(a);
                    }
                    this._innerResolutions = this._resolutions.slice(0);
                }
            }
            this._mapInit();
        }
        if (this._innerResolutions && this._innerResolutions.length > 0) {
            this._raise_resolutionsPrepared(this._innerResolutions);
        }
        d.setMap(this);
        this._layerRender(d, b);
    },
    _checkBounds: function(a) {
        if (!this._bounds) {
            this._bounds = new SuperMap.Web.Core.Rectangle2D();
        }
        if (a.get_bounds() != null) {
            this._bounds.union(a.get_bounds());
        } else {
            a.set_bounds(this._bounds.clone());
        }
    },
    _mapInit: function() {
        if (this._viewBounds == null || this._viewBounds.isEmpty()) {
            var a = this._bounds.clone();
            this._rectify(a);
        } else {
            this._rectify(this._viewBounds);
        }
    },
    _computeOrigin: function(a) {
        var b = new SuperMap.Web.Core.Point2D(a.leftBottom.x, a.rightTop.y);
        var c = this.mapToScreen(b);
        return c;
    },
    _getBoundsOriginPos: function() {
        var a = new SuperMap.Web.Core.Point2D(this._bounds.leftBottom.x, this._bounds.rightTop.y);
        var b = this.mapToScreen(a);
        return b;
    },
    _layerRender: function(c, b) {
        var a = c.get_container();
        if (a == null || typeof(a) == "undefined") {
            a = document.createElement("div");
            a.style.position = "absolute";
            a.id = this._mapDiv.id + "_[" + b + "]_Div";
            a.style.top = "0px";
            a.style.left = "0px";
            a.style.zIndex = b * 5;
            a.style.MozUserSelect = "none";
            a.style.width = this._width + "px";
            a.style.height = this._height + "px";
            c.set_container(a);
        } else {
            a.id = this._mapDiv.id + "_[" + b + "]_Div";
            a.style.zIndex = b * 5;
        }
        this._mapDiv.appendChild(a);
        if (this._layerCollection.isInitialized()) {
            this._layerCollection.draw();
        }
    },
    _rectify: function(g) {
        if (this._viewBounds != null) {
            this._lastViewBounds = this._viewBounds.clone();
        }
        var f = g.width() / g.height();
        var e = this._width / this._height;
        if (f < e) {
            var c = e * g.height();
            var d = g.center().x - c / 2;
            var k = g.center().x + c / 2;
            var b = g.center().y - g.height() / 2;
            var j = g.center().y + g.height() / 2;
            this._viewBounds = new SuperMap.Web.Core.Rectangle2D(d, b, k, j);
        } else {
            if (f > e) {
                var l = g.width() / e;
                var b = g.center().y - l / 2;
                var j = g.center().y + l / 2;
                var d = g.center().x - g.width() / 2;
                var k = g.center().x + g.width() / 2;
                this._viewBounds = new SuperMap.Web.Core.Rectangle2D(d, b, k, j);
            } else {
                if (f == e) {
                    if (this._viewBounds == null) {
                        this._viewBounds = g;
                    } else {
                        this._viewBounds.leftBottom.x = g.leftBottom.x;
                        this._viewBounds.leftBottom.y = g.leftBottom.y;
                        this._viewBounds.rightTop.x = g.rightTop.x;
                        this._viewBounds.rightTop.y = g.rightTop.y;
                    }
                }
            }
        }
        var h = this._viewBounds.width() / this._width;
        var i = this._viewBounds.height() / this._height;
        this._resolution = h < i ? h : i;
        this._resolution = this._rectifyResolution(this._resolution);
        var a = this._viewBounds.center();
        this._viewBounds.leftBottom.x = a.x - this._resolution * this._width / 2;
        this._viewBounds.leftBottom.y = a.y - this._resolution * this._height / 2;
        this._viewBounds.rightTop.x = a.x + this._resolution * this._width / 2;
        this._viewBounds.rightTop.y = a.y + this._resolution * this._height / 2;
    },
    _zoomToResolution: function(c, a) {
        c = this._rectifyResolution(c);
        if (typeof(a) == "undefined" || a.isEmpty()) {
            var g = this._viewBounds.center().x - c * this._width / 2;
            var d = this._viewBounds.center().x + c * this._width / 2;
            var f = this._viewBounds.center().y + c * this._height / 2;
            var b = this._viewBounds.center().y - c * this._height / 2;
        } else {
            var g = a.x - c * this._width / 2;
            var d = a.x + c * this._width / 2;
            var f = a.y + c * this._height / 2;
            var b = a.y - c * this._height / 2;
        }
        var e = new SuperMap.Web.Core.Rectangle2D(g, b, d, f);
        this._isZooming = true;
        this.set_viewBounds(e);
        this._isZooming = false;
    },
    _rectifyResolution: function(a) {
        if (this._innerResolutions != null) {
            for (var b = 0; b < this._innerResolutions.length - 1; b++) {
                if (a <= this._innerResolutions[b] && a >= this._innerResolutions[b + 1]) {
                    a = (this._innerResolutions[b] - a) < (a - this._innerResolutions[b + 1]) ? this._innerResolutions[b] : this._innerResolutions[b + 1];
                    break;
                } else {
                    if (a < this._innerResolutions[this._innerResolutions.length - 1]) {
                        a = this._innerResolutions[this._innerResolutions.length - 1];
                        break;
                    } else {
                        if (a > this._innerResolutions[0]) {
                            a = this._innerResolutions[0];
                            break;
                        }
                    }
                }
            }
            return a;
        }
        return a;
    },
    _resize: function() {
        if (!this._viewBounds) {
            return;
        }
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            this._width = this._element.offsetWidth;
            this._height = this._element.offsetHeight;
        } else {
            this._width = this._element.clientWidth;
            this._height = this._element.clientHeight;
        }
        this._mapDiv.style.width = this._width;
        this._mapDiv.style.height = this._height;
        this._workLayer.style.width = this._width;
        this._workLayer.style.height =this._height;
        var a = this._viewBounds.center();
        var f = a.x - this._resolution * this._width / 2;
        var b = a.y - this._resolution * this._height / 2;
        var c = a.x + this._resolution * this._width / 2;
        var e = a.y + this._resolution * this._height / 2;
        var d = new SuperMap.Web.Core.Rectangle2D(f, b, c, e);
        this.set_viewBounds(d);
    },
    _resetPosition: function() {
        var e = this._mapDiv.style.left;
        var b = Number(e.substring(0, (e.length - 2)));
        var f = this._mapDiv.style.top;
        var a = Number(f.substring(0, (f.length - 2)));
        this._mapDiv.style.left = "0px";
        this._mapDiv.style.top = "0px";
        for (var d = 0; d < this._mapDiv.childNodes.length; d++) {
            for (var c = 0; c < this._mapDiv.childNodes[d].childNodes.length; c++) {
                this._elementStyleChange(this._mapDiv.childNodes[d].childNodes[c], a, b);
            }
        }
    },
    _elementStyleChange: function(g, j, f, c, m) {
        if (!g) {
            return;
        }
        if (j) {
            var i = g.style.top;
            var b = Number(i.substring(0, (i.length - 2)));
            b += j;
            g.style.top = b + "px";
        }
        if (f) {
            var l = g.style.left;
            var k = Number(l.substring(0, (l.length - 2)));
            k += f;
            g.style.left = k + "px";
        }
        if (c) {
            var a = g.style.width;
            var e = Number(a.substring(0, (a.length - 2)));
            e += c;
            g.style.width = e + "px";
        }
        if (m) {
            var h = g.style.height;
            var d = Number(h.substring(0, (h.length - 2)));
            d += m;
            g.style.height = d + "px";
        }
    },
    _stepPan: function() {
        this.pan(this._panningX, this._panningY);
        while (this._panCounter > 0) {
            this._panCounter--;
            if (this._panCounter != 0) {
                this.pan(this._panningX, this._panningY);
            }
        }
        this.stopDynamicPan();
    },
    _refershMousePosition: function() {
        var b = this._mousePosition.mapCoord.x.toFixed(3);
        var a = this._mousePosition.mapCoord.y.toFixed(3);
        this._mousePositionDiv.innerHTML = "(" + b + "," + a + ") " + this._mousePosition.pixelCoord;
    },
    _keyDown: function(d) {
        d = SuperMap.Web.Utility.getEvent(d);
        var c = this._keyboardPanDistance;
        var a = this._panningX;
        var f = this._panningY;
        switch (d.keyCode) {
        case 9:
            if (this._panning && this._keyboardPanning) {
                this.stopDynamicPan();
            }
            return true;
        case 37:
            a = -c;
            break;
        case 38:
            f = -c;
            break;
        case 39:
            a = c;
            break;
        case 40:
            f = c;
            break;
        case 107:
        case 187:
        case 61:
        case 43:
            a = 0;
            f = 0;
            var b;
            if (this._innerResolutions.length > 0) {
                if (this.get_level() < 0) {
                    b = this._innerResolutions[0];
                } else {
                    if (this.get_level() >= this._innerResolutions.length - 1) {
                        b = this._innerResolutions[this._innerResolutions.length - 1];
                    } else {
                        b = this._innerResolutions[this.get_level() + 1];
                    }
                }
            } else {
                b = this._rectifyResolution(this._resolution / 2);
            }
            try {
                this._zoomToResolution(b);
            } catch(d) {
                alert(d.message);
            } finally {
                b = null;
            }
            break;
        case 109:
        case 189:
        case 45:
            a = 0;
            f = 0;
            var b;
            if (this._innerResolutions.length > 0) {
                if (this.get_level() <= 0) {
                    b = this._innerResolutions[0];
                } else {
                    if (this.get_level() > this._innerResolutions.length - 1) {
                        b = this._innerResolutions[this._innerResolutions.length - 1];
                    } else {
                        b = this._innerResolutions[this.get_level() - 1];
                    }
                }
            } else {
                b = this._rectifyResolution(this._resolution * 2);
            }
            try {
                this._zoomToResolution(b);
            } catch(d) {
                alert(d.message);
            } finally {
                b = null;
            }
            break;
        default:
            return false;
        }
        if (a || f) {
            this.panByPixel(a, f);
        }
        if (this._debug) {
            window.status = "e.keyCode:" + d.keyCode;
        }
        return false;
    },
    _keyUp: function(b) {
        b = SuperMap.Web.Utility.getEvent(b);
        var a = this._panningX;
        var c = this._panningY;
        switch (b.keyCode) {
        case 37:
            a = 0;
            break;
        case 38:
            c = 0;
            break;
        case 39:
            a = 0;
            break;
        case 40:
            c = 0;
            break;
        default:
            return false;
        }
        this._action.onKeyUp(b);
        return false;
    },
    _mouseDown: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        this._getEventPosition(a);
        if (this._action && this._action.onMouseDown) {
            this._action.onMouseDown(a);
        }
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            this._element.setCapture();
        } else {
            document.addEventListener("mousemove", this._mouseMoveDelegate, true);
            document.addEventListener("mouseup", this._mouseUpDelegate, true);
        }
        return false;
    },
    _mouseMove: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        this._getEventPosition(a);
        this.raise_mouseMove(this._mousePosition);
        if (this._action && this._action.onMouseMove) {
            this._action.onMouseMove(a);
        }
        return false;
    },
    _mouseUp: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        if (Sys.Browser.name != "Microsoft Internet Explorer" && a.currentTarget == document) {
        } else {
            SuperMap.Web.Utility.cancelBubble(a);
        }
        this._getEventPosition(a);
        if (this._action && this._action.onMouseUp) {
            this._action.onMouseUp(a);
        }
        this._kbInput.focus();
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            this._element.releaseCapture();
        } else {
            document.removeEventListener("mousemove", this._mouseMoveDelegate, true);
            document.removeEventListener("mouseup", this._mouseUpDelegate, true);
        }
        return false;
    },
    _click: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        this._getEventPosition(a);
        if (this._action && this._action.onClick) {
            this._action.onClick(a);
        }
    },
    _dblClick: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        this._getEventPosition(a);
        if (this._action && this._action.onDblClick) {
            this._action.onDblClick(a);
        } else {
        }
    },
    _contextMenu: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        this._getEventPosition(a);
        if (a.preventDefault) {
            a.preventDefault();
        }
        return false;
    },
    _mouseWheel: function(c) {
        if (!this._isStartWheel) {
            this._isStartWheel = true;
            c = SuperMap.Web.Utility.getEvent(c);
            SuperMap.Web.Utility.cancelBubble(c);
            if (this._isZooming) {
                return false;
            }
            this._getEventPosition(c);
            var d = SuperMap.Web.Utility.getMouseScrollDelta(c);
            if (d > 0) {
                var b;
                if (this._innerResolutions.length > 0) {
                    if (this.get_level() < 0) {
                        b = this._innerResolutions[0];
                    } else {
                        if (this.get_level() >= this._innerResolutions.length - 1) {
                            b = this._innerResolutions[this._innerResolutions.length - 1];
                        } else {
                            b = this._innerResolutions[this.get_level() + 1];
                        }
                    }
                } else {
                    b = this._rectifyResolution(this._resolution / 2);
                }
                try {
                    var a = this._getCenterByMousePosition(b, c);
                    this._zoomToResolution(b, a);
                } catch(c) {
                    alert(c.message);
                } finally {
                    b = null;
                }
            }
            if (d < 0) {
                var b;
                if (this._innerResolutions.length > 0) {
                    if (this.get_level() <= 0) {
                        b = this._innerResolutions[0];
                    } else {
                        if (this.get_level() > this._innerResolutions.length - 1) {
                            b = this._innerResolutions[this._innerResolutions.length - 1];
                        } else {
                            b = this._innerResolutions[this.get_level() - 1];
                        }
                    }
                } else {
                    b = this._rectifyResolution(this._resolution * 2);
                }
                try {
                    var a = this._getCenterByMousePosition(b, c);
                    this._zoomToResolution(b, a);
                } catch(c) {
                    alert(c.message);
                } finally {
                    b = null;
                }
            }
            this._controlMouseWheelTimeOut = window.setTimeout(this._controlMouseWheelDelegate, 500);
            return false;
        }
    },
    _mouseScroll: function(c) {
        if (!this._isStartWheel) {
            this._isStartWheel = true;
            c = SuperMap.Web.Utility.getEvent(c);
            SuperMap.Web.Utility.cancelBubble(c);
            this._getEventPosition(c);
            if (this._isPanning || this._isZooming) {
                return false;
            }
            var d = -c.detail / 3;
            if (d > 0) {
                var b;
                if (this._innerResolutions.length > 0) {
                    if (this.get_level() < 0) {
                        b = this._innerResolutions[0];
                    } else {
                        if (this.get_level() >= this._innerResolutions.length - 1) {
                            b = this._innerResolutions[this._innerResolutions.length - 1];
                        } else {
                            b = this._innerResolutions[this.get_level() + 1];
                        }
                    }
                } else {
                    b = this._rectifyResolution(this._resolution / 2);
                }
                try {
                    var a = this._getCenterByMousePosition(b, c);
                    this._zoomToResolution(b, a);
                } catch(c) {
                    alert(c.message);
                } finally {
                    b = null;
                }
            } else {
                if (d < 0) {
                    var b;
                    if (this._innerResolutions.length > 0) {
                        if (this.get_level() <= 0) {
                            b = this._innerResolutions[0];
                        } else {
                            if (this.get_level() > this._innerResolutions.length - 1) {
                                b = this._innerResolutions[this._innerResolutions.length - 1];
                            } else {
                                b = this._innerResolutions[this.get_level() - 1];
                            }
                        }
                    } else {
                        b = this._rectifyResolution(this._resolution * 2);
                    }
                    try {
                        var a = this._getCenterByMousePosition(b, c);
                        this._zoomToResolution(b, a);
                    } catch(c) {
                        alert(c.message);
                    } finally {
                        b = null;
                    }
                }
            }
            if (c.preventDefault) {
                c.preventDefault();
            }
            this._controlMouseWheelTimeOut = window.setTimeout(this._controlMouseWheelDelegate, 500);
            return false;
        }
    },
    _controlMouseWheel: function() {
        this._isStartWheel = false;
        window.clearTimeout(this._controlMouseWheelTimeOut);
    },
    _bindEvent: function() {
        $addHandler(this._element, "mousedown", this._mouseDownDelegate);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            $addHandler(this._element, "mouseup", this._mouseUpDelegate);
        }
        $addHandler(this._element, "mousemove", this._mouseMoveDelegate);
        if (document.addEventListener) {
            this._element.addEventListener("DOMMouseScroll", this._mouseScrollDelegate, true);
        }
        $addHandler(this._element, "mousewheel", this._mouseWheelDelegate);
        $addHandler(this._element, "dblclick", this._dblClickDelegate);
        $addHandler(this._element, "contextmenu", this._contextMenuDelegate);
        $addHandler(this._element, "click", this._clickDelegate);
        $addHandler(this._kbInput, "keydown", this._keyDownDelegate);
        $addHandler(this._kbInput, "keyup", this._keyUpDelegate);
    },
    _getEventPosition: function(a) {
        a.pixelCoord = new SuperMap.Web.Core.Point(SuperMap.Web.Utility.getMouseX(a) - this._x, SuperMap.Web.Utility.getMouseY(a) - this._y);
        this._mousePosition.pixelCoord = a.pixelCoord;
        a.mapCoord = this.screenToMap(a.pixelCoord);
        this._mousePosition.mapCoord = a.mapCoord;
    },
    _getPosition: function() {
        this._x = SuperMap.Web.Utility.getElementX(this._workLayer);
        this._y = SuperMap.Web.Utility.getElementY(this._workLayer);
        if (this._element.style.borderLeftWidth) {
            this._x += parseInt(this._element.style.borderLeftWidth);
        }
        if (this._element.style.borderTopWidth) {
            this._y += parseInt(this._element.style.borderTopWidth);
        }
    },
    _panRange: function(a) {
        if (this._restrictedBounds !== null && !this._restrictedBounds.isEmpty()) {
            if (a.center().x < this._restrictedBounds.leftBottom.x) {
                a.leftBottom.x = this._restrictedBounds.leftBottom.x - this._viewBounds.width() / 2;
                a.rightTop.x = this._restrictedBounds.leftBottom.x + this._viewBounds.width() / 2;
            }
            if (a.center().y < this._restrictedBounds.leftBottom.y) {
                a.leftBottom.y = this._restrictedBounds.leftBottom.y - this._viewBounds.height() / 2;
                a.rightTop.y = this._restrictedBounds.leftBottom.y + this._viewBounds.height() / 2;
            }
            if (a.center().x > this._restrictedBounds.rightTop.x) {
                a.rightTop.x = this._restrictedBounds.rightTop.x + this._viewBounds.width() / 2;
                a.leftBottom.x = this._restrictedBounds.rightTop.x - this._viewBounds.width() / 2;
            }
            if (a.center().y > this._restrictedBounds.rightTop.y) {
                a.rightTop.y = this._restrictedBounds.rightTop.y + this._viewBounds.height() / 2;
                a.leftBottom.y = this._restrictedBounds.rightTop.y - this._viewBounds.height() / 2;
            }
        }
        return a;
    },
    _getCenterByMousePosition: function(d, g) {
        var d = d;
        var f = SuperMap.Web.Utility.getMouseX(g) - SuperMap.Web.Utility.getElementX(this._mapDiv);
        var c = SuperMap.Web.Utility.getMouseY(g) - SuperMap.Web.Utility.getElementY(this._mapDiv);
        var a = (this._width / 2 - f) * d;
        var h = (this._height / 2 - c) * d;
        var b = this.screenToMap(new SuperMap.Web.Core.Point(f, c));
        return new SuperMap.Web.Core.Point2D(b.x + a, b.y - h);
    },
    _updataMapDiv: function(a) {
        var d = a + "1";
        for (var c = 0; c < this._mapDiv.childNodes.length; c++) {
            if (this._mapDiv.childNodes[c].id == a) {
                for (var b = 0; b < this._mapDiv.childNodes[c].childNodes.length; b++) {
                    this._mapDiv.childNodes[c].removeChild(this._mapDiv.childNodes[c].childNodes[b]);
                }
                this._mapDiv.removeChild(this._mapDiv.childNodes[c]);
            }
            if (this._mapDiv.childNodes[c]) {
                if (this._mapDiv.childNodes[c].id == d) {
                    for (var b = 0; b < this._mapDiv.childNodes[c].childNodes.length; b++) {
                        this._mapDiv.childNodes[c].removeChild(this._mapDiv.childNodes[c].childNodes[b]);
                    }
                    this._mapDiv.removeChild(this._mapDiv.childNodes[c]);
                }
            }
        }
    },
    _returnDefalut: function() {
        if (this._layerCollection.length() == 0) {
            this._restrictedBounds = null;
            this._viewBounds = null;
            this._bounds = null;
            this._dpi = null;
            this._resolution = null;
            this._scales = null;
            this._resolutions = new Array();
            this._innerResolutions = new Array();
            this._crs = null;
        }
    },
    _regWinResize: function() {
        var a = this;
        Sys.UI.DomEvent.addHandler(window, "resize", function() { a._resize(); });
    },
    _add_resolutionsPrepared: function(a) { this._addEvent("resolutionsPrepared", a); },
    _remove_resolutionsPrepared: function(a) { this._removeEvent("resolutionsPrepared", a); },
    _raise_resolutionsPrepared: function(a, b) { this._raiseEvent("resolutionsPrepared", a, b); },
    add_layerRemoved: function(a) { this._addEvent("layerRemoved", a); },
    remove_layerRemoved: function(a) { this._removeEvent("layerRemoved", a); },
    raise_layerRemoved: function(a, b) { this._raiseEvent("layerRemoved", a, b); },
    add_baseLayerInitialized: function(a) { this._addEvent("baseLayerInitialized", a); },
    remove_baseLayerInitialized: function(a) { this._removeEvent("baseLayerInitialized", a); },
    raise_baseLayerInitialized: function(a, b) { this._raiseEvent("baseLayerInitialized", a, b); },
    add_actionChanged: function(a) { this._addEvent("actionChanged", a); },
    remove_actionChanged: function(a) { this._removeEvent("actionChanged", a); },
    raise_actionChanged: function(a, b) { this._raiseEvent("actionChanged", a, b); },
    add_mouseMove: function(a) { this._addEvent("mouseMove", a); },
    remove_mouseMove: function(a) { this._removeEvent("mouseMove", a); },
    raise_mouseMove: function(a, b) { this._raiseEvent("mouseMove", a, b); },
    add_viewBoundsChanged: function(a) { this._addEvent("viewBoundsChanged", a); },
    remove_viewBoundsChanged: function(a) { this._removeEvent("viewBoundsChanged", a); },
    raise_viewBoundsChanged: function(a, b) { this._raiseEvent("viewBoundsChanged", a, b); },
    add_staticPanelLoaded: function(a) { this._addEvent("staticPanelLoaded", a); },
    remove_staticPanelLoaded: function(a) { this._removeEvent("staticPanelLoaded", a); },
    raise_staticPanelLoaded: function(a, b) { this._raiseEvent("staticPanelLoaded", a, b); },
    add_sizeChanged: function(a) { this._addEvent("sizeChanged", a); },
    remove_sizeChanged: function(a) { this._removeEvent("sizeChanged", a); },
    raise_sizeChanged: function(a, b) { this._raiseEvent("sizeChanged", a, b); },
    _addEvent: function(a, b) { this.get_events().addHandler(a, b); },
    _removeEvent: function(a, b) { this.get_events().removeHandler(a, b); },
    _raiseEvent: function(a, c, d) {
        var b = this.get_events().getHandler(a);
        if (b) {
            b(c, d);
        }
    }
};
SuperMap.Web.Mapping.Map.registerClass("SuperMap.Web.Mapping.Map", Sys.UI.Control, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.InfoWindowAnchor = function() { throw Error.notImplemented(); };
SuperMap.Web.Mapping.InfoWindowAnchor.prototype = { ANCHOR_TOPLEFT: 1, ANCHOR_TOPCENTER: 2, ANCHOR_TOPRIGHT: 3, ANCHOR_MIDDLELEFT: 4, ANCHOR_MIDDLECENTER: 5, ANCHOR_MIDDLERIGHT: 6, ANCHOR_BOTTOMLEFT: 7, ANCHOR_BOTTOMCENTER: 8, ANCHOR_BOTTOMRIGHT: 9 };
SuperMap.Web.Mapping.InfoWindowAnchor.registerEnum("SuperMap.Web.Mapping.InfoWindowAnchor");
SuperMap.Web.Mapping.InfoWindow = function(a) {
    this._map = a.map;
    this._caption = a.caption;
    this._content = a.content;
    this._showing = false;
    this._coords = null;
    this._location = null;
    this._anchor = null;
    this._offset = null;
    if (arguments[1]) {
        this._putOnDelegate = Function.createDelegate(this, this._putOn);
        this._map.add_staticPanelLoaded(this._putOnDelegate);
    } else {
        this._createTemplete();
        this._setCaption();
        this._setContent();
    }
    this._placementDelegate = Function.createDelegate(this, this._adjustPlacement);
    this._map.add_viewBoundsChanged(this._placementDelegate);
};
SuperMap.Web.Mapping.InfoWindow.prototype = {
    get_showing: function() { return this._showing; },
    get_width: function() { return this._infoWindowContainer.offsetWidth; },
    get_height: function() { return this._infoWindowContainer.offsetHeight; },
    get_coords: function() { return this._showing ? this._coords : null; },
    show: function(c, a, b) {
        if (!c) {
            return;
        }
        if (!a) {
            a = SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_TOPLEFT;
        }
        if (!b) {
            b = { x: 0, y: 0 };
        }
        this._location = c;
        this._anchor = a;
        this._offset = b;
        if (this._showing) {
            this._adjustPlacement();
        } else {
            this._infoWindowContainer.style.display = "block";
            this._showing = true;
            this._adjustPlacement();
        }
    },
    hide: function() {
        this._showing = false;
        this._infoWindowContainer.style.display = "none";
    },
    dispose: function() { this._dispose(); },
    resize: function(b, a) {
        if (b >= this._infoWindowContainer.offsetWidth) {
            this._infoWindowContainer.style.width = b + "px";
        }
        if (a >= this._infoWindowContainer.offsetHeight) {
            this._infoWindowContainer.style.height = a + "px";
        }
    },
    setCaption: function(a) {
        this._caption = a;
        this._setCaption();
    },
    setContent: function(a) {
        this._content = a;
        this._setContent();
    },
    setAnchor: function(a, b) {
        if (!a || !this._showing) {
            return;
        }
        this._anchor = a;
        if (b) {
            this._offset = b;
        }
        if (this._showing) {
            this._adjustPlacement();
        }
    },
    insertDomNode: function(a) { this._infoWindowContainer.appendChild(a); },
    _adjustPlacement: function() {
        if (!this._showing) {
            return;
        }
        var b = this._infoWindowContainer.offsetWidth;
        var a = this._infoWindowContainer.offsetHeight;
        this._coords = this._map.mapToScreen(this._location);
        switch (this._anchor) {
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_TOPLEFT:
            this._infoWindowContainer.style.left = this._coords.x + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_TOPRIGHT:
            this._infoWindowContainer.style.left = this._coords.x - b + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_BOTTOMLEFT:
            this._infoWindowContainer.style.left = this._coords.x + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y - a + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_BOTTOMRIGHT:
            this._infoWindowContainer.style.left = this._coords.x - b + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y - a + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_TOPCENTER:
            this._infoWindowContainer.style.left = this._coords.x - b / 2 + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_BOTTOMCENTER:
            this._infoWindowContainer.style.left = this._coords.x - b / 2 + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y - a + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_MIDDLELEFT:
            this._infoWindowContainer.style.left = this._coords.x + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y - a / 2 + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_MIDDLERIGHT:
            this._infoWindowContainer.style.left = this._coords.x - b + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y - a / 2 + this._offset.y + "px";
            break;
        case SuperMap.Web.Mapping.InfoWindowAnchor.ANCHOR_MIDDLECENTER:
            this._infoWindowContainer.style.left = this._coords.x - b / 2 + this._offset.x + "px";
            this._infoWindowContainer.style.top = this._coords.y - a / 2 + this._offset.y + "px";
            break;
        }
    },
    _setCaption: function() {
        if (typeof(this._caption) == "object") {
            this._removeChilds(this._infoWindowCaption);
            this._infoWindowCaption.appendChild(this._caption);
        } else {
            if (typeof(this._caption) == "string") {
                this._infoWindowCaption.innerHTML = this._caption;
            }
        }
    },
    _setContent: function() {
        if (typeof(this._content) == "object") {
            this._removeChilds(this._infoWindowContent);
            this._infoWindowContent.appendChild(this._content);
        } else {
            if (typeof(this._content) == "string") {
                this._infoWindowContent.innerHTML = this._content;
            }
        }
    },
    _removeChilds: function(d) {
        for (var b = 0, e = d.childNodes, a = e.length; b < a; b++) {
            d.removeChild(e[b]);
        }
    },
    _putOn: function(a) {
        this._map.remove_staticPanelLoaded(this._putOnDelegate);
        this._createTemplete();
        this._setCaption();
        this._setContent();
    },
    _dispose: function() {
        this._map._workLayer.removeChild(this._infoWindowContainer);
        this._map = null;
        this._caption = null;
        this._content = null;
        this._showing = null;
        this._coords = null;
        this._location = null;
        this._anchor = null;
        this._offset = null;
        this._infoWindowCaption = null;
        this._infoWindowContent = null;
        this._infoWindowClose = null;
    },
    _createTemplete: function() {
        this._infoWindowContainer = document.createElement("div");
        this._infoWindowContainer.className = "sm_infoWindowContainer";
        this._infoWindowContainer.style.display = "none";
        this._infoWindowContainer.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.onmouseup = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.onmousemove = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.onclick = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.ondblclick = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.onmousewheel = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.oncontextmenu = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.onkeydown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowContainer.onkeyup = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._infoWindowCaption = document.createElement("div");
        this._infoWindowCaption.className = "sm_infoWindowCaption";
        this._infoWindowContent = document.createElement("div");
        this._infoWindowContent.className = "sm_infoWindowContent";
        this._infoWindowClose = document.createElement("div");
        this._infoWindowClose.className = "sm_infoWindowClose";
        this._infoWindowCloseDelegate = Function.createDelegate(this, this.hide);
        $addHandler(this._infoWindowClose, "click", this._infoWindowCloseDelegate);
        this._infoWindowContainer.appendChild(this._infoWindowCaption);
        this._infoWindowContainer.appendChild(this._infoWindowContent);
        this._infoWindowContainer.appendChild(this._infoWindowClose);
        this._map._workLayer.appendChild(this._infoWindowContainer);
    }
};
SuperMap.Web.Mapping.InfoWindow.registerClass("SuperMap.Web.Mapping.InfoWindow", Sys.Component, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.Layer = function() {
    SuperMap.Web.Mapping.Layer.initializeBase(this);
    this._id = "";
    this._url;
    this._isLoaded = false;
    this._caption = "";
    this._bounds = null;
    this._maxVisibleScale;
    this._minVisibleScale;
    this._scale;
    this._viewBounds = null;
    this._isVisible = true;
    this._crs = new SuperMap.Web.Core.CoordinateReferenceSystem();
    this._container = null;
    this._zIndex = null;
    this._renderMode = 1;
    this._resolution = null;
    this._clipRegion = null;
    this._discription = "";
    this._isDraw = true;
    this._type = "layer";
    this._isBaseLayer = false;
};
SuperMap.Web.Mapping.Layer.prototype = {
    get_id: function() { return this._id; },
    set_id: function(a) { this._id = a; },
    get_url: function() { return this._url; },
    set_url: function(a) { this._url = a; },
    get_caption: function() { return this._caption; },
    set_caption: function(a) { this._caption = a; },
    get_isVisible: function() { return this._isVisible; },
    set_isVisible: function(a) { this._isVisible = a; },
    get_crs: function() { return this._crs; },
    set_crs: function(a) { this._crs = a; },
    get_clipRegion: function() { return this._clipRegion; },
    set_clipRegion: function(a) { this._clipRegion = a; },
    get_discription: function() { return this._discription; },
    set_discription: function(a) { this._discription = a; },
    get_container: function() { return this._container; },
    set_container: function(container) {
        var e = Function._validateParams(arguments, [{ name: "container", domElement: true }]);
        if (e) {
            throw e;
        }
        this._container = container;
        this._width = (container.style.width + "").replace("px", "");
        this._width = this._width.replace("pt", "");
        this._width = eval(this._width);
        this._height = (container.style.height + "").replace("px", "");
        this._height = this._height.replace("pt", "");
        this._height = eval(this._height);
    },
    get_zIndex: function() {
        if (this._container1) {
            if (this._container.style.zIndex >= 0) {
                return this._container.style.zIndex;
            }
            if (this._container1.style.zIndex >= 0) {
                return this._container1.style.zIndex;
            }
        } else {
            return this._container.style.zIndex;
        }
    },
    set_zIndex: function(a) {
        this._containerIndex = a;
        if (this._container1) {
            if (this._container.style.zIndex >= 0) {
                this._container.style.zIndex = a;
            }
            if (this._container1.style.zIndex >= 0) {
                this._container1.style.zIndex = a;
            }
        } else {
            this._container.style.zIndex = a;
        }
    },
    get_isLoaded: function() { return this._isLoaded; },
    get_bounds: function() { return this._bounds; },
    set_bounds: function(a) {
        var b = Function._validateParams(arguments, [{ name: "bounds", type: SuperMap.Web.Core.Rectangle2D }]);
        if (b) {
            throw b;
        }
        this._bounds = a;
    },
    get_resolution: function() { return this._resolution; },
    set_resolution: function(a) {
        var b = Function._validateParams(arguments, [{ name: "resolution", type: Number }]);
        if (b) {
            return false;
        }
        this._resolution = a;
    },
    get_type: function() { return this._type; },
    resize: function(b, a) {
        this._width = b;
        this._height = a;
        if (this._container) {
            this._container.style.width = this._width;
            this._container.style.height = this._height;
        }
        if (this._container1) {
            this._container1.style.width = this._width;
            this._container1.style.height = this._height;
        }
    },
    draw: function() {
    },
    setMap: function(b) {
        var a = Function._validateParams(arguments, [{ name: "map", type: SuperMap.Web.Mapping.Map }]);
        if (a) {
            throw a;
        }
        this._map = b;
    },
    _applyVisible: function() {
        if (!this._isVisible) {
            this._container.style.display = "none";
        } else {
            this._container.style.display = "block";
        }
        return;
    },
    add_initialized: function(a) { this._addEvent("loaded", a); },
    remove_initialized: function(a) { this._removeEvent("loaded", a); },
    raise_initialized: function(a, b) { this._raiseEvent("loaded", a, b); },
    add_initializing: function(a) { this._addEvent("loading", a); },
    remove_initializing: function(a) { this._removeEvent("loading", a); },
    raise_initializing: function(a, b) { this._raiseEvent("loading", argument, b); },
    add_failed: function(a) { this._addEvent("failed", a); },
    remove_failed: function(a) { this._removeEvent("failed", a); },
    raise_failed: function(a, b) { this._raiseEvent("failed", a, b); },
    _addEvent: function(a, b) { this.get_events().addHandler(a, b); },
    _removeEvent: function(a, b) { this.get_events().removeHandler(a, b); },
    _raiseEvent: function(a, b, d) {
        var c = this.get_events().getHandler(a);
        if (c) {
            c(b, d);
        }
    }
};
SuperMap.Web.Mapping.Layer.registerClass("SuperMap.Web.Mapping.Layer", Sys.Component);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.ImageLayer = function() {
    SuperMap.Web.Mapping.ImageLayer.initializeBase(this);
    this._imageFormat = "png";
};
SuperMap.Web.Mapping.ImageLayer.prototype = { get_imageFormat: function() { return this._imageFormat; }, set_imageFormat: function(a) { this._imageFormat = a; } };
SuperMap.Web.Mapping.ImageLayer.registerClass("SuperMap.Web.Mapping.ImageLayer", SuperMap.Web.Mapping.Layer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.MarkerLayer = function() {
    SuperMap.Web.Mapping.MarkerLayer.initializeBase(this);
    this._markerList = new Array();
    this._type = "MarkerLayer";
    this._countMarker = 0;
};
SuperMap.Web.Mapping.MarkerLayer.prototype = {
    get_markers: function() { return this._markerList; },
    dispose: function() {
        if (typeof(this._map) != "undefined") {
            this._map.remove_viewBoundsChanged(this._viewBoundsChangedDelegate);
            this._map.remove_layerRemoved(this._unLoadDelegate);
        }
        delete this._container;
    },
    initialize: function() {
        var b = Function.createDelegate(this, this._onInitComplete);
        var a = Function.createDelegate(this, this._onInitError);
        this._viewBoundsChangedDelegate = Function.createDelegate(this, this._viewBoundsChanged);
        this._unLoadDelegate = Function.createDelegate(this, this._unLoad);
        this._initialized = true;
    },
    setMap: function(b) {
        var a = Function._validateParams(arguments, [{ name: "map", type: SuperMap.Web.Mapping.MapControl }]);
        if (a) {
            throw a;
        }
        this._map = b;
        this._viewBounds = this._map.get_viewBounds().clone();
        this._map.add_viewBoundsChanged(this._viewBoundsChangedDelegate);
    },
    draw: function() {
        this._applyVisible();
        var b = this._map._computeOrigin(this._bounds);
        this._originX = b.x;
        this._originY = b.y;
        for (var c = 0; c < this._markerList.length; c++) {
            var a = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(this._markerList[c]._x, this._markerList[c]._y));
            this._markerList[c]._element.style.position = "absolute";
            this._markerList[c]._element.style.left = a.x - this._markerList[c]._offsetX + "px";
            this._markerList[c]._element.style.top = a.y - this._markerList[c]._offsetY + "px";
        }
        this._firstOriginX = this._originX;
        this._firstOriginY = this._originY;
    },
    refresh: function() { this.draw(); },
    repositionMarker: function(e, a, d) {
        var b = this.getMarker(e);
        if (!!b) {
            b.set_x(a);
            b.set_y(d);
            var c = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(a, d));
            b._element.style.left = c.x - b._offsetX + "px";
            b._element.style.top = c.y - b._offsetY + "px";
            return true;
        }
        return false;
    },
    addMarker: function(a) {
        if (a.get_id()) {
            for (var b = 0; b < this._markerList.length; b++) {
                if (this._markerList[b].get_id() === a.get_id()) {
                    if (SuperMap.Web.Utility.isDebug) {
                        console.warn("Marker's id repeat");
                    }
                    return false;
                }
            }
        } else {
            this._countMarker++;
            a.set_id("Untitled" + this._countMarker);
        }
        this._markerList.push(a);
        this._appendMarker(a);
    },
    getMarker: function(b) {
        if (b) {
            for (var a = 0; a < this._markerList.length; a++) {
                if (this._markerList[a].get_id() == b) {
                    return this._markerList[a];
                }
            }
            return null;
        }
    },
    removeMarker: function(a) {
        if (a) {
            for (var b = 0; b < this._markerList.length; b++) {
                if (this._markerList[b] === a) {
                    this._markerList[b].remove();
                    this._markerList.splice(b, 1);
                }
            }
        } else {
            var c = this._markerList.length;
            while (c > 0) {
                a = this._markerList.pop();
                a.remove();
                c--;
            }
        }
    },
    removeMarkerById: function(c) {
        if (c) {
            for (var a = 0; a < this._markerList.length; a++) {
                if (this._markerList[a].get_id() == c) {
                    this._container.removeChild(this._markerList[a]._element);
                    this._markerList[a].dispose();
                    this._markerList.splice(a, 1);
                }
            }
        } else {
            var b = this._markerList.length;
            while (b > 0) {
                this._container.removeChild(this._markerList[b - 1]._element);
                this._markerList[b - 1].dispose();
                this._markerList.splice(b - 1, 1);
                b--;
            }
        }
    },
    _appendMarker: function(a) {
        a._element.style.MozUserSelect = "none";
        a._element.ondrag = function() { return false; };
        a._element.ondragend = function() { return false; };
        a._element.onmousedown = function() { return false; };
        var b = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(a._x, a._y));
        a._element.style.position = "absolute";
        a._element.style.left = b.x - a._offsetX + "px";
        a._element.style.top = b.y - a._offsetY + "px";
        this._container.appendChild(a._element);
    },
    _viewBoundsChanged: function() {
        this._viewBounds = this._map.get_viewBounds().clone();
        var b = this._map._computeOrigin(this._bounds);
        this._originX = b.x;
        this._originY = b.y;
        var c = this._map.get_isZooming();
        if (c) {
            this.draw();
            this._firstOriginX = this._originX;
            this._firstOriginY = this._originY;
        } else {
            if (this._map._panActionMark) {
                var a = this._originX - this._firstOriginX;
                var d = this._originY - this._firstOriginY;
                this._container.style.left = a + "px";
                this._container.style.top = d + "px";
            } else {
                this._container.style.left = 0 + "px";
                this._container.style.top = 0 + "px";
                this.draw();
            }
        }
    },
    _unLoad: function() { this._container.parentNode.removeChild(this._container); }
};
SuperMap.Web.Mapping.MarkerLayer.registerClass("SuperMap.Web.Mapping.MarkerLayer", SuperMap.Web.Mapping.Layer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.Layers = function() { this._layers = new Array(); };
SuperMap.Web.Mapping.Layers.prototype = {
    isInitialized: function() {
        for (var a = 0; a < this._layers.length; a++) {
            if (!this._layers[a].get_isInitialized()) {
                return false;
            }
        }
        return true;
    },
    length: function() { return this._layers.length; },
    crs: function() {
        if (this._layers.length > 0) {
            var b = this._layers.length;
            for (var a = 0; a < b; a++) {
                if (this._layers[a].get_crs().wkid != 0) {
                    return this._layers[a].get_crs().clone();
                }
            }
        }
        return new SuperMap.Web.Core.CoordinateReferenceSystem(0, -1);
    },
    push: function(b, a) { Array.insert(this._layers, a, b); },
    remove: function(b) {
        if (b) {
            for (var a = 0; a < this._layers.length; a++) {
                if (b === this._layers[a]) {
                    this._layers.splice(a, 1);
                    b._unLoad();
                }
            }
        } else {
            while (this._layers.length > 0) {
                b = this._layers.pop();
                b._unLoad();
            }
        }
    },
    removeById: function(b) {
        for (var a = 0; a < this._layers.length; a++) {
            if (b == this._layers[a].get_id()) {
                this._layers[a]._unLoad();
                this._layers.splice(a, 1);
            }
        }
    },
    refresh: function() {
        for (var a = 0; a < this._layers.length; a++) {
            this._layers[a].refresh();
        }
    },
    draw: function() {
        for (var a = 0; a < this._layers.length; a++) {
            this._layers[a].draw();
        }
    }
};
SuperMap.Web.Mapping.Layers.registerClass("SuperMap.Web.Mapping.Layers");
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.DynamicLayer = function() {
    SuperMap.Web.Mapping.DynamicLayer.initializeBase(this);
    this._type = "DynamicLayer";
};
SuperMap.Web.Mapping.DynamicLayer.prototype = {
    dispose: function() {
        if (this._dynamicImage) {
            this._dynamicImage.ondrag = null;
            this._dynamicImage.onmousedown = null;
            this._dynamicImage.onerror = null;
            this._dynamicImage.onload = null;
            this._dynamicImage = null;
            delete this._dynamicImage;
        }
        if (this._map) {
            this._map.remove_viewBoundsChanged(this._viewBoundsChangedDelegate);
            this._map.remove_layerRemoved(this._unLoadDelegate);
        }
        this._map = null;
    },
    initialize: function() {
        this._viewBoundsChangedDelegate = Function.createDelegate(this, this._viewBoundsChanged);
        this._unLoadDelegate = Function.createDelegate(this, this._unLoad);
        this._initialized = true;
        this.raise_initialized(this);
    },
    setMap: function(a) {
        this._map = a;
        this._viewBounds = this._map.get_viewBounds().clone();
        this._map.add_viewBoundsChanged(this._viewBoundsChangedDelegate);
    },
    draw: function() {
        this._applyVisible();
        var a = this._map._computeOrigin(this._bounds);
        this._originX = a.x;
        this._originY = a.y;
        if (!this._isDraw) {
            return false;
        }
        this._clearDynamicImage();
        this._createDynamicImage();
        this._firstOriginX = this._originX;
        this._firstOriginY = this._originY;
    },
    refresh: function() {
        this._clearDynamicImage();
        this._createDynamicImage();
    },
    _clearDynamicImage: function() {
        if (this._dynamicImage != null && this._container.hasChildNodes()) {
            this._container.removeChild(this._dynamicImage);
            this._dynamicImage.src = null;
            this._dynamicImage = null;
        }
    },
    _createDynamicImage: function() {
        if (this._container) {
            var b = this._getImageUrl();
            var c = this._viewBounds.leftBottom.x + "," + this._viewBounds.leftBottom.y + "," + this._viewBounds.rightTop.x + "," + this._viewBounds.rightTop.y;
            this._dynamicImage = null;
            this._dynamicImage = new Image();
            this._dynamicImage.id = c;
            this._dynamicImage.src = b;
            this._dynamicImage.style.position = "relative";
            this._dynamicImage.style.left = "0px";
            this._dynamicImage.style.top = "0px";
            this._dynamicImage.style.zIndex = this._container.style.zIndex;
            this._dynamicImage.style.MozUserSelect = "none";
            this._dynamicImage.ondrag = function() { return false; };
            this._dynamicImage.onmousedown = function() { return false; };
            var a = Function.createDelegate(this, this._imageError);
            this._dynamicImage.onerror = a;
            if (Sys.Browser.name == "Microsoft Internet Explorer" || Sys.Browser.name == "Opera") {
                this._container.appendChild(this._dynamicImage);
            } else {
                var d = Function.createDelegate(this, this._imageAppend);
                this._dynamicImage.onload = d;
            }
        } else {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "DynamicImageLayer_createDynamicImage_NoContainer"));
        }
    },
    _viewBoundsChanged: function() {
        this._viewBounds = this._map.get_viewBounds().clone();
        var d = this._map.get_originX();
        var c = this._map.get_originY();
        var b = this._map._computeOrigin(this._bounds);
        this._originX = b.x;
        this._originY = b.y;
        var e = this._map.get_isZooming();
        if (e) {
            this._clearDynamicImage();
            this._createDynamicImage();
            this._firstOriginX = this._originX;
            this._firstOriginY = this._originY;
        } else {
            if (this._map._panActionMark) {
                var a = this._originX - this._firstOriginX;
                var f = this._originY - this._firstOriginY;
                this._dynamicImage.style.left = a + "px";
                this._dynamicImage.style.top = f + "px";
            } else {
                this.draw();
            }
        }
    },
    _unLoad: function() {
        if (this._dynamicImage != null) {
            this._container.removeChild(this._dynamicImage);
            this._dynamicImage.src = null;
            delete this._dynamicImage;
        }
        this._container.parentNode.removeChild(this._container);
        this.dispose();
    },
    _imageError: function() {
        if (SuperMap.Web.Utility.isDebug) {
            console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "DynamicLayer_createDynamicImage_ImagePathError"));
        }
        return false;
    },
    _imageAppend: function() { this._container.appendChild(this._dynamicImage); }
};
SuperMap.Web.Mapping.DynamicLayer.registerClass("SuperMap.Web.Mapping.DynamicLayer", SuperMap.Web.Mapping.ImageLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.TiledLayer = function() {
    SuperMap.Web.Mapping.TiledLayer.initializeBase(this);
    this._tiles = null;
    this._oldTiles = null;
    this._tileSize = 256;
    this._urls = new Array();
    this._cachedTileCount = 32;
    this._imageBuffer = new Array();
    this._cachedCycleCount = 0;
    this._enableImageBuffer = true;
    this._enableSpiralLoad = false;
    this._imageOpacity = 100;
    this._tileStartX = null;
    this._tileStartY = null;
    this._tileEndX = null;
    this._tileEndY = null;
    this._originX;
    this._originY;
    this._oldOriginX;
    this._oldOriginY;
    this._tileCountX = 0;
    this._tileCountY = 0;
    this._isZoomingComplete = true;
    this._oldScale;
    this._loadedTileListenerDelegate = Function.createDelegate(this, this._loadTileListener);
    this._tileSetFactorDelegate = Function.createDelegate(this, this._tileSetFactor);
    this._offsetX;
    this._offsetY;
    this._containerNum = 0;
    this._container1 = null;
    this._containerIndex = 0;
    this._oldTileStartX = null;
    this._oldTileStartY = null;
    this._intervalNum;
    this._stepNum = 0;
    this._ratio = 0;
    this._currentClientX = 0;
    this._currentClientY = 0;
    this._oldStartX = 0;
    this._oldStartY = 0;
    this._enlargeOver = true;
    this._containPosX = 0;
    this._containPosY = 0;
};
SuperMap.Web.Mapping.TiledLayer.prototype = {
    get_tileSize: function() { return this._tileSize; },
    set_tileSize: function(a) { this._tileSize = a; },
    get_cachedTileCount: function() { return this._cachedTileCount; },
    set_cachedTileCount: function(a) { this._cachedTileCount = a; },
    get_cachedCycleCount: function() { return this._cachedCycleCount; },
    set_cachedCycleCount: function(a) { this._cachedCycleCount = a; },
    get_zoomTotalSteps: function() { return this._zoomTotalSteps; },
    set_zoomTotalSteps: function(a) { this._zoomTotalSteps = a; },
    get_tiles: function() { return this._tiles; },
    get_enableSpiralLoad: function() { return this._enableSpiralLoad; },
    set_enableSpiralLoad: function(b) {
        var a = Function._validateParams(arguments, [{ name: "enableSpiralLoad", type: Boolean }]);
        if (a) {
            throw a;
        }
        this._enableSpiralLoad = b;
    },
    get_urls: function() { return this._urls; },
    set_urls: function(b) {
        var a = Function._validateParams(arguments, [{ name: "urls", type: Array, elementType: String }]);
        if (a) {
            throw a;
        }
        this._urls = b;
    },
    get_enableImageBuffer: function() { return this._enableImageBuffer; },
    set_enableImageBuffer: function(a) { this._enableImageBuffer = a; },
    initialize: function() {
        this._viewBoundsChangedDelegate = Function.createDelegate(this, this._viewBoundsChanged);
        this._unLoadDelegate = Function.createDelegate(this, this._unLoad);
        this._initialized = true;
        this.raise_initialized(this);
    },
    dispose: function() {
        if (typeof(this._map) != "undefined" && !!this._map) {
            this._map.remove_viewBoundsChanged(this._viewBoundsChangedDelegate);
            this._map.remove_layerRemoved(this._unLoadDelegate);
        }
        while (this._container && this._container.hasChildNodes()) {
            this._container.removeChild(this._container.firstChild);
        }
        while (this._container1 && this._container1.hasChildNodes()) {
            this._container1.removeChild(this._container1.firstChild);
        }
        this._map = null;
        this._oldTiles = null;
        if (!!this._tiles) {
            for (var b = 0; b < this._tiles.length; b++) {
                for (var a = 0; a < this._tiles[b].length; a++) {
                    if (this._tiles[b][a]._image) {
                        this._tiles[b][a]._image.ondrag = null;
                        this._tiles[b][a]._image.ondragend = null;
                        this._tiles[b][a]._image.onmousedown = null;
                    }
                    this._tiles[b][a] = null;
                }
            }
        }
        this._tiles = null;
        if (!!this._imageBuffer) {
            for (var b = 0; b < this._imageBuffer.length; b++) {
                if (!!this._imageBuffer[b]._image) {
                    this._imageBuffer[b]._image.ondrag = null;
                    this._imageBuffer[b]._image.ondragend = null;
                    this._imageBuffer[b]._image.onmousedown = null;
                }
                this._imageBuffer[b] = null;
            }
        }
        this._imageBuffer = null;
    },
    setMap: function(a) {
        this._map = a;
        this._viewBounds = this._map.get_viewBounds().clone();
        this._map.add_viewBoundsChanged(this._viewBoundsChangedDelegate);
    },
    draw: function() {
        this._applyVisible();
        var a = this._map._computeOrigin(this._bounds);
        this._originX = -1 * a.x;
        this._originY = -1 * a.y;
        this._scale = this._map.get_scale();
        this._resolution = this._map.get_resolution();
        this._displayImage();
    },
    refresh: function() {
        while (this._container && this._container.hasChildNodes()) {
            this._container.removeChild(this._container.firstChild);
        }
        while (this._container1 && this._container1.hasChildNodes()) {
            this._container1.removeChild(this._container1.firstChild);
        }
        this._oldTiles = new Array();
        this._tiles = new Array();
        this._imageBuffer = new Array();
        this.draw();
    },
    _displayImage: function() {
        this._initializeLoadTile();
        this._oldOriginX = this._originX;
        this._oldOriginY = this._originY;
        this._oldTileStartX = this._tileStartX;
        this._oldTileStartY = this._tileStartY;
        this._oldResolution = this._resolution;
    },
    _initializeLoadTile: function() {
    },
    _zoomAnimation1: function() {
        if (this._container1 == null) {
            this._installContainer1();
        }
        if (this._containerNum == 0) {
            this._containerNum = 1;
        } else {
            this._containerNum = 0;
        }
    },
    _installContainer1: function() {
        this._container1 = document.createElement("div");
        this._container1.style.position = "absolute";
        this._container1.id = this._container.id + "1";
        this._container1.style.top = "0px";
        this._container1.style.left = "0px";
        this._container1.style.zIndex = this._container.style.zIndex - 1;
        this._container1.style.MozUserSelect = "none";
        this._container1.style.width = this._container.style.width;
        this._container1.style.height = this._container.style.height;
        this._container.parentNode.appendChild(this._container1);
        this._containerIndex = this._container.style.zIndex;
    },
    _changeContainerIndex: function() {
        if (this._containerNum == 0) {
            if (this._containerIndex == 0) {
                this._container.style.zIndex = this._containerIndex;
                this._container1.style.zIndex = this._containerIndex - 1;
            } else {
                this._container.style.zIndex = this._containerIndex;
                this._container1.style.zIndex = -(this._containerIndex);
            }
        } else {
            if (this._containerIndex == 0) {
                this._container1.style.zIndex = this._containerIndex;
                this._container.style.zIndex = this._containerIndex - 1;
            } else {
                this._container1.style.zIndex = this._containerIndex;
                this._container.style.zIndex = -(this._containerIndex);
            }
        }
        this._containPosX = 0;
        this._containPosY = 0;
        if (this._containerNum == 0) {
            this._container.style.left = this._containPosX + "px";
            this._container.style.top = this._containPosY + "px";
        } else {
            this._container1.style.left = this._containPosX + "px";
            this._container1.style.top = this._containPosY + "px";
        }
    },
    _clearOldTiles: function() {
        if (this._oldTiles) {
            for (var b = 0; b < this._oldTiles.length; b++) {
                for (var a = 0; a < this._oldTiles[b].length; a++) {
                    this._removeTileFromMapZoom(this._oldTiles[b][a]);
                    this._oldTiles[b][a] = null;
                }
            }
            this._oldTiles = null;
        }
    },
    _clearTiles: function() {
        if (this._tiles) {
            for (var b = 0; b < this._tiles.length; b++) {
                for (var a = 0; a < this._tiles[b].length; a++) {
                    this._removeTileFromMap(this._tiles[b][a]);
                    this._tiles[b][a] = null;
                }
            }
            this._tiles = null;
        }
    },
    _clearOldTiles1: function() {
        if (this._oldTiles) {
            for (var d = 0; d < this._oldTiles.length; d++) {
                for (var c = 0; c < this._oldTiles[d].length; c++) {
                    if (this._oldTiles[d][c]._image) {
                        if (this._enableImageBuffer) {
                            for (var b = 0; this._imageBuffer && b < this._imageBuffer.length; b++) {
                                if (this._imageBuffer[b].id == this._oldTiles[d][c].id) {
                                    var a = this._imageBuffer.splice(b, 1);
                                    a[0].image.onload = null;
                                    a[0].image.onerror = null;
                                    a[0].image.onmousedown = null;
                                    a[0].image = null;
                                    delete a[0].image;
                                    delete a[0];
                                    a = null;
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    _enlargeImg: function(g, c, b) {
        if (this._oldTiles != null && this._oldTiles[0] != null) {
            var f = this._tileSize * this._oldTiles[0].length;
            var a = this._tileSize * this._oldTiles.length;
            for (var e = 0; e < this._oldTiles.length; e++) {
                for (var d = 0; d < this._oldTiles[e].length; d++) {
                    this._oldTiles[e][d]._image.style.left = c + d * this._tileSize * g + "px";
                    this._oldTiles[e][d]._image.style.top = b + e * this._tileSize * g + "px";
                    this._oldTiles[e][d]._image.width = this._tileSize * g + 1;
                    this._oldTiles[e][d]._image.height = this._tileSize * g + 1;
                    this._oldTiles[e][d].posX = c + d * this._tileSize * g;
                    this._oldTiles[e][d].posY = b + e * this._tileSize * g;
                }
            }
        }
    },
    _computeEnlargeSteps1: function() {
        this._stepNum++;
        if (this._stepNum <= 2) {
            var e = 0;
            for (var d = 1; d <= this._stepNum; d++) {
                e = e + d;
            }
            var c = ((this._ratio - 1) * e * 0.07) + 1;
            var b = (1 - c) * this._currentClientX + this._oldStartX * c;
            var a = (1 - c) * this._currentClientY + this._oldStartY * c;
            this._enlargeImg(c, b, a);
        }
        if (3 <= this._stepNum && this._stepNum <= 6) {
            var e = 0;
            for (var d = 3; d <= this._stepNum; d++) {
                e = e + (7 - d);
            }
            var c = ((this._ratio - 1) * 0.07 * e + 1);
            var b = (1 - c) * this._currentClientX + this._oldStartX * c;
            var a = (1 - c) * this._currentClientY + this._oldStartY * c;
            this._enlargeImg(c, b, a);
        }
        if (this._stepNum == 7) {
            var c = ((this._ratio - 1) * 14 * 0.07) + 1;
            var b = (1 - c) * this._currentClientX + this._oldStartX * c;
            var a = (1 - c) * this._currentClientY + this._oldStartY * c;
            this._enlargeImg(c, b, a);
        }
        if (this._stepNum == 7) {
            clearInterval(this._intervalNum);
            this._intervalNum = null;
            this._stepNum = 0;
            this._displayImage();
            this._enlargeOver = true;
            this._clearOldTiles1();
            if (this._transparent && this._transparent == true) {
                this._clearOldTiles();
            }
        }
    },
    _computeEnlargeSteps6: function() {
        this._stepNum++;
        if (1 <= this._stepNum && this._stepNum <= 2) {
            var e = 0;
            for (var d = 1; d <= this._stepNum; d++) {
                e = e + (1 + 2 * d);
            }
            var c = ((this._ratio - 1) * 0.11 * e + 1);
            var b = (1 - c) * this._currentClientX + this._oldStartX * c;
            var a = (1 - c) * this._currentClientY + this._oldStartY * c;
            this._enlargeImg(c, b, a);
        }
        if (this._stepNum == 3) {
            var c = ((this._ratio - 1) * 0.11 * 9 + 1);
            var b = (1 - c) * this._currentClientX + this._oldStartX * c;
            var a = (1 - c) * this._currentClientY + this._oldStartY * c;
            this._enlargeImg(c, b, a);
        }
        if (this._stepNum == 3) {
            clearInterval(this._intervalNum);
            this._intervalNum = null;
            this._stepNum = 0;
            this._displayImage();
            this._enlargeOver = true;
            this._clearOldTiles1();
            if (this._transparent && this._transparent == true) {
                this._clearOldTiles();
            }
        }
    },
    _initEnlargeImg: function() {
        if (this._tiles == null) {
            this._displayImage();
            this._enlargeOver = true;
            return;
        }
        this._clearOldTiles();
        this._zoomAnimation1();
        this._changeContainerIndex();
        this._oldTiles = new Array();
        for (var d = 0; d < this._tiles.length; d++) {
            this._oldTiles[d] = new Array();
            for (var c = 0; c < this._tiles[d].length; c++) {
                this._oldTiles[d][c] = this._tiles[d][c];
                this._tiles[d][c] = null;
            }
        }
        this._tiles = null;
        this._ratio = (this._oldResolution / this._resolution);
        if (this._ratio != 1) {
            var b = -1 * this._originX + this._oldTileStartX * this._tileSize * this._ratio;
            var a = -1 * this._originY + this._oldTileStartY * this._tileSize * this._ratio;
            if (this._oldTiles != null && this._oldTiles[0] != null && this._oldTiles[0][0] != null) {
                this._oldStartX = this._pxToNum(this._oldTiles[0][0]._image.style.left);
                this._oldStartY = this._pxToNum(this._oldTiles[0][0]._image.style.top);
            }
            this._currentClientX = (b - this._ratio * this._oldStartX) / (1 - this._ratio);
            this._currentClientY = (a - this._ratio * this._oldStartY) / (1 - this._ratio);
            if (0.2 < this._ratio && this._ratio < 4) {
                var e = Function.createDelegate(this, this._computeEnlargeSteps6);
                this._intervalNum = setInterval(e, 50);
            } else {
                var e = Function.createDelegate(this, this._computeEnlargeSteps1);
                this._intervalNum = setInterval(e, 50);
            }
        } else {
            this._initializeLoadTile();
            this._oldOriginX = this._originX;
            this._oldOriginY = this._originY;
            this._oldTileStartX = this._tileStartX;
            this._oldTileStartY = this._tileStartY;
            this._enlargeOver = true;
        }
    },
    _pxToNum: function(c) {
        var b = c;
        var a = Number(b.substring(0, (b.length - 2)));
        return a;
    },
    _removeTileFromMapZoom: function(a) {
        a._image._loaded = false;
        if (a._image) {
            if (this._containerNum == 1) {
                if (a._image.parentNode == this._container) {
                    this._container.removeChild(a._image);
                    a._image.src = null;
                    a._image = null;
                }
            } else {
                if (a._image.parentNode == this._container1) {
                    this._container1.removeChild(a._image);
                    a._image.src = null;
                    a._image = null;
                }
            }
            delete a;
        }
        a = null;
    },
    _zoomLoadTile: function() {
        if (this._scale != this._oldScale) {
            clearTimeout(this._iTimeoutIDForCheckTileLoaded);
            this._isZoomingComplete = false;
            this._tiles = null;
            this._interimMeasures();
        }
    },
    _interimMeasures: function() {
        if (this._oldTiles) {
            var h = this._scale / this._oldScale;
            for (var g = 0; g < this._oldTiles.length; g++) {
                for (var f = 0; f < this._oldTiles[g].length; f++) {
                    var k = this._oldTiles[g][f];
                    k.nPosX = Math.floor((this._oldOriginX + k.posX) * h - this._originX);
                    k.nPosY = Math.floor((this._oldOriginY + k.posY) * h - this._originY);
                    k.nSize = Math.ceil(this._tileSize * h);
                    if (this._zoomTotalSteps && (typeof(this._zoomTotalSteps) == "number")) {
                        k.xSteps = null;
                        k.ySteps = null;
                        k.sizeSteps = null;
                        k.xSteps = new Array();
                        k.ySteps = new Array();
                        k.sizeSteps = new Array();
                        for (var e = 0; e <= this._zoomTotalSteps; e++) {
                            var d = e / this._zoomTotalSteps;
                            var c = 1 - d;
                            k.xSteps[e] = Math.floor(c * k.posX + d * k.nPosX);
                            k.ySteps[e] = Math.floor(c * k.posY + d * k.nPosY);
                            k.sizeSteps[e] = Math.floor(c * this._tileSize + d * k.nSize);
                        }
                    }
                }
            }
        }
    },
    _getBufferedImage: function(b) {
        if (this._enableImageBuffer) {
            for (var a = 0; this._imageBuffer && a < this._imageBuffer.length; a++) {
                if (this._imageBuffer[a].id == b) {
                    return this._imageBuffer[a].image;
                }
            }
        }
        return null;
    },
    _removeBufferedImage: function(b) {
        if (this._enableImageBuffer) {
            for (var a = 0; this._imageBuffer && a < this._imageBuffer.length; a++) {
                if (this._imageBuffer[a].id === b.id) {
                    return this._imageBuffer.splice(a, 1);
                }
            }
        }
    },
    _repositionImage: function(a, g) {
        var f = this._tiles.length;
        for (var d = 0; d < f; d++) {
            var b = this._tiles[d].length;
            for (var c = 0; c < b; c++) {
                this._tiles[d][c].posX = this._tiles[d][c].posX - a;
                this._tiles[d][c].posY = this._tiles[d][c].posY - g;
                var e = this._tiles[d][c]._image.style;
                e.left = this._tiles[d][c].posX + "px";
                e.top = this._tiles[d][c].posY + "px";
            }
        }
        this._containPosX = this._containPosX - a;
        this._containPosY = this._containPosY - g;
        if (this._containerNum == 1) {
            this._container.style.left = this._containPosX + "px";
            this._container.style.top = this._containPosY + "px";
        } else {
            if (this._container1) {
                this._container1.style.left = this._containPosX + "px";
                this._container1.style.top = this._containPosY + "px";
            }
        }
    },
    _removeTileFromMap: function(a) {
        a._image._loaded = false;
        if (a._image) {
            if (this._containerNum == 1) {
                if (a._image.parentNode == this._container1) {
                    this._removeBufferedImage(a);
                    a._image.src = null;
                    this._container1.removeChild(a._image);
                }
            } else {
                if (a._image.parentNode == this._container) {
                    this._removeBufferedImage(a);
                    a._image.src = null;
                    this._container.removeChild(a._image);
                }
            }
            delete a;
        }
        a = null;
    },
    _tileSetFactor: function() {
        if (this._tiles == null || this._tiles.length == null) {
            return;
        }
        var d = this._tiles.length;
        for (var c = 0; c < d; c++) {
            var b = this._tiles[c].length;
            for (var a = 0; a < b; a++) {
                if (!this._tiles[c][a]._image._loaded) {
                    if (SuperMap.Web.Utility.GetBrowser() == "ie") {
                        if (this._tiles[c][a]._image.readyState == "complete") {
                            if (this._containerNum == 0) {
                                this._container.appendChild(this._tiles[c][a]._image);
                            } else {
                                this._container1.appendChild(this._tiles[c][a]._image);
                            }
                            this._tiles[c][a]._image._loaded = true;
                        }
                    } else {
                        if (this._tiles[c][a]._image.complete) {
                            if (this._containerNum == 0) {
                                this._container.appendChild(this._tiles[c][a]._image);
                            } else {
                                this._container1.appendChild(this._tiles[c][a]._image);
                            }
                            this._tiles[c][a]._image._loaded = true;
                        }
                    }
                }
            }
        }
    },
    _erasingOldTiles: function() {
        if (this._oldTiles) {
            for (var c = 0; c < this._oldTiles.length; c++) {
                for (var b = 0; b < this._oldTiles[c].length; b++) {
                    var e;
                    if (this._enableImageBuffer) {
                        for (var a = 0; this._imageBuffer && a < this._imageBuffer.length; a++) {
                            if (this._imageBuffer[a].id == this._oldTiles[c][b].id) {
                                e = a;
                                break;
                            }
                        }
                    }
                    if (e || e == 0) {
                        var d = this._imageBuffer.splice(e, 1);
                    }
                    if (d[0].image.parentNode == this._container) {
                        d[0].image.parentNode.removeChild(d[0].image);
                    }
                    d[0].image.src = null;
                    d[0].image.onload = null;
                    d[0].image.onerror = null;
                    delete d[0].image;
                    d[0].image = null;
                    d = null;
                    this._oldTiles[c][b] = null;
                }
            }
            this._oldTiles = null;
        }
    },
    _verifyReload: function(b, a) {
        var e = this._map._viewBounds.intersect(this._bounds);
        var d = Math.floor(((e.leftBottom.x - this._bounds.leftBottom.x) + (this._resolution * 0.5)) / (this._resolution * this._tileSize));
        var c = Math.floor(((this._bounds.rightTop.y - e.rightTop.y) + (this._resolution * 0.5)) / (this._resolution * this._tileSize));
        d = (d < 0) ? 0 : d;
        c = (c < 0) ? 0 : c;
        var g = Math.floor(((e.rightTop.x - this._bounds.leftBottom.x) - (this._resolution * 0.5)) / (this._resolution * this._tileSize));
        var f = Math.floor(((this._bounds.rightTop.y - e.leftBottom.y) - (this._resolution * 0.5)) / (this._resolution * this._tileSize));
        if ((d >= this._tileStartX && d <= this._tileEndX) && (c >= this._tileStartY && c <= this._tileEndY)) {
            return false;
        } else {
            if ((d >= this._tileStartX && d <= this._tileEndX) && (f >= this._tileStartY && f <= this._tileEndY)) {
                return false;
            } else {
                if ((g >= this._tileStartX && g <= this._tileEndX) && (c >= this._tileStartY && c <= this._tileEndY)) {
                    return false;
                } else {
                    if ((g >= this._tileStartX && g <= this._tileEndX) && (f >= this._tileStartY && f <= this._tileEndY)) {
                        return false;
                    } else {
                        return true;
                    }
                }
            }
        }
    },
    _viewBoundsChanged: function() {
        if (this._map == null) {
            return;
        }
        this._container.style.width = this._map._width + "px";
        this._container.style.height = this._map._height + "px";
        this._width = this._map._width;
        this._height = this._map._height;
        var a = this._map._computeOrigin(this._bounds);
        this._originX = -1 * a.x;
        this._originY = -1 * a.y;
        var b = this._map.get_isZooming();
        if (this._resolution != this._map.get_resolution()) {
            this._scale = this._map.get_scale();
            this._resolution = this._map.get_resolution();
            if (this._enlargeOver == false) {
                clearInterval(this._intervalNum);
                this._intervalNum = null;
                this._stepNum = 0;
                this._displayImage();
                this._enlargeOver = true;
            } else {
                this._enlargeOver = false;
                this._initEnlargeImg();
            }
        } else {
            if (this._enlargeOver == false) {
                clearInterval(this._intervalNum);
                this._intervalNum = null;
                this._stepNum = 0;
                this._displayImage();
                this._enlargeOver = true;
            }
            this._resolution = this._map.get_resolution();
            this._displayImage();
        }
    },
    _unLoad: function() {
        while (this._container.childNodes.length > 0) {
            this._container.childNodes[0].src = null;
            if (Sys.Browser.name != "Microsoft Internet Explorer") {
                delete this._container.childNodes[0];
            }
            this._container.removeChild(this._container.childNodes[0]);
        }
        this._container.parentNode.removeChild(this._container);
        if (this._container1 != null) {
            while (this._container1.childNodes.length > 0) {
                this._container1.childNodes[0].src = null;
                if (Sys.Browser.name != "Microsoft Internet Explorer") {
                    delete this._container.childNodes[0];
                }
                this._container1.removeChild(this._container1.childNodes[0]);
            }
            this._container1.parentNode.removeChild(this._container1);
        }
        this.dispose();
    }
};
SuperMap.Web.Mapping.TiledLayer.registerClass("SuperMap.Web.Mapping.TiledLayer", SuperMap.Web.Mapping.ImageLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.DynamicWMSLayer = function() {
    SuperMap.Web.Mapping.DynamicWMSLayer.initializeBase(this);
    this._layers = null;
    this._version = null;
    this._crs = null;
    this._bgColor = "";
    this._transparent = true;
    this._time;
    this._exceptions;
    this._elevation;
    this._latLongCRSRanges = [[4001, 4999], [2044, 2045], [2081, 2083], [2085, 2086], [2093, 2093], [2096, 2098], [2105, 2132], [2169, 2170], [2176, 2180], [2193, 2193], [2200, 2200], [2206, 2212], [2319, 2319], [2320, 2462], [2523, 2549], [2551, 2735], [2738, 2758], [2935, 2941], [2953, 2953], [3006, 3030], [3034, 3035], [3058, 3059], [3068, 3068], [3114, 3118], [3126, 3138], [3300, 3301], [3328, 3335], [3346, 3346], [3350, 3352], [3366, 3366], [3416, 3416], [20004, 20032], [20064, 20092], [21413, 21423], [21473, 21483], [21896, 21899], [22171, 22177], [22181, 22187], [22191, 22197], [25884, 25884], [27205, 27232], [27391, 27398], [27492, 27492], [28402, 28432], [28462, 28492], [30161, 30179], [30800, 30800], [31251, 31259], [31275, 31279], [31281, 31290], [31466, 31700]];
    this._dynamicImage = null;
    this._width;
    this._height;
    this._type = "DynamicWMSLayer";
};
SuperMap.Web.Mapping.DynamicWMSLayer.prototype = {
    get_layers: function() { return this._layers; },
    set_layers: function(a) { this._layers = a; },
    get_version: function() { return this._version; },
    set_version: function(a) { this._version = a; },
    get_transparent: function() { return this._transparent; },
    set_transparent: function(a) { this._transparent = a; },
    get_crs: function() { return this._crs; },
    set_crs: function(a) { this._crs = a; },
    get_bgColor: function() { return this._bgColor; },
    set_bgColor: function(a) { this._bgColor = a; },
    set_bounds: function(a) {
        var b = Function._validateParams(arguments, [{ name: "bounds", type: SuperMap.Web.Core.Rectangle2D }]);
        if (b) {
            throw b;
        }
        this._bounds = a;
    },
    _getImageUrl: function() {
        if (!this._url || !this._layers || !this._version || !this._crs) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "DynamicWMSLayer_getImageUrl_VariableIllegal"));
        }
        if (!this._viewBounds || this._viewBounds.isEmpty()) {
            this._viewBounds = this._map.get_viewBounds().clone();
        }
        this._getWidthHeightFromStyle();
        var c = this._crs.wkid;
        var d = "";
        d = d + this._url + "?service=WMS&request=GetMap&width=" + this._width + "&height=" + this._height + "&format=image/" + this._imageFormat + "&layers=" + this._layers.toString() + "&styles=&bgcolor=" + this._bgColor + "&transparent=" + this._transparent + "&version=" + this._version;
        switch (this._version) {
        case "1.1.1":
            d = d + "&SRS=EPSG:" + c + "&bbox=" + this._viewBounds.leftBottom.x + "," + this._viewBounds.leftBottom.y + "," + this._viewBounds.rightTop.x + "," + this._viewBounds.rightTop.y;
            break;
        case "1.3":
        case "1.3.0":
            d = d + "&CRS=EPSG:" + c;
            var e = false;
            var b = this._latLongCRSRanges.length;
            for (var a = 0; a < b; a++) {
                if (c >= this._latLongCRSRanges[a][0] && c <= this._latLongCRSRanges[a][1]) {
                    e = true;
                    break;
                }
            }
            if (e) {
                d = d + "&bbox=" + this._viewBounds.leftBottom.y + "," + this._viewBounds.leftBottom.x + "," + this._viewBounds.rightTop.y + "," + this._viewBounds.rightTop.x;
            } else {
                d = d + "&bbox=" + this._viewBounds.leftBottom.x + "," + this._viewBounds.leftBottom.y + "," + this._viewBounds.rightTop.x + "," + this._viewBounds.rightTop.y;
            }
            break;
        }
        return d;
    },
    _getWidthHeightFromStyle: function() {
        this._width = (this._container.style.width + "").replace("px", "");
        this._width = this._width.replace("pt", "");
        this._width = eval(this._width);
        this._height = (this._container.style.height + "").replace("px", "");
        this._height = this._height.replace("pt", "");
        this._height = eval(this._height);
    }
};
SuperMap.Web.Mapping.DynamicWMSLayer.registerClass("SuperMap.Web.Mapping.DynamicWMSLayer", SuperMap.Web.Mapping.DynamicLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.TiledCachedLayer = function() {
    SuperMap.Web.Mapping.TiledCachedLayer.initializeBase(this);
    this._resolutions = new Array();
};
SuperMap.Web.Mapping.TiledCachedLayer.prototype = {
    get_resolutions: function() { return this._resolutions; },
    getTileUrl: function(b, a, c) {
    },
    _initializeLoadTile: function() {
        var D = this._originX;
        var B = this._originY;
        if (!this._cachedCycleCount && this._cachedCycleCount != 0) {
            this._cachedCycleCount = 1;
        }
        if (!this._tileSize) {
            this._tileSize = 256;
        }
        if ((!this._tiles) || (this._tiles.length == 0) || this._verifyReload(D, B)) {
            this._clearTiles();
            this._tiles = new Array();
            var m = this._map._viewBounds.intersect(this._bounds);
            var u = Math.floor(((m.leftBottom.x - this._bounds.leftBottom.x) + (this._resolution * 0.5)) / (this._resolution * this._tileSize));
            var t = Math.floor(((this._bounds.rightTop.y - m.rightTop.y) + (this._resolution * 0.5)) / (this._resolution * this._tileSize));
            u = (u < 0) ? 0 : u;
            t = (t < 0) ? 0 : t;
            this._tileStartX = u;
            this._tileStartY = t;
            var H = Math.floor(((m.rightTop.x - this._bounds.leftBottom.x) - (this._resolution * 0.5)) / (this._resolution * this._tileSize));
            var G = Math.floor(((this._bounds.rightTop.y - m.leftBottom.y) - (this._resolution * 0.5)) / (this._resolution * this._tileSize));
            this._tileEndX = H;
            this._tileEndY = G;
            var h = H - u + 1;
            var g = G - t + 1;
            this._tileCount = h * g;
            var e = this._scale;
            if (this._enableSpiralLoad) {
                var d = new Array();
                for (var l = t; l <= G; l++) {
                    var v = new Array();
                    for (var p = u; p <= H; p++) {
                        var I = new Object();
                        I.x = p;
                        I.y = l;
                        I.queued = false;
                        v.push(I);
                    }
                    d.push(v);
                    var o = new Array();
                    this._tiles.push(o);
                }
                var a = new Array();
                var r = ["right", "down", "left", "up"];
                var f = 0;
                var c = -1;
                var F = 0;
                var A = 0;
                while (A < r.length) {
                    var w = f;
                    var k = c;
                    switch (r[F]) {
                    case "right":
                        k++;
                        break;
                    case "down":
                        w++;
                        break;
                    case "left":
                        k--;
                        break;
                    case "up":
                        w--;
                        break;
                    }
                    var I = null;
                    if ((w < g) && (w >= 0) && (k < h) && (k >= 0)) {
                        I = d[w][k];
                    }
                    if ((I != null) && (!I.queued)) {
                        a.unshift(I);
                        I.queued = true;
                        A = 0;
                        f = w;
                        c = k;
                    } else {
                        F = (F + 1) % 4;
                        A++;
                    }
                }
                for (var z = 0; z < a.length; z++) {
                    var b = a[z];
                    var I = this._createTile(b.x, b.y, this._resolution, D, B);
                    this._tiles[b.y - t][b.x - u] = I;
                }
                a = null;
                while (d.length > 0) {
                    var v = d.pop();
                    while (v.length > 0) {
                        var b = v.pop();
                        b = null;
                    }
                    v = null;
                }
                d = null;
            } else {
                for (var l = t; l <= G; l++) {
                    var v = new Array();
                    for (var p = u; p <= H; p++) {
                        var I = this._createTile(p, l, this._resolution, D, B);
                        v.push(I);
                    }
                    this._tiles.push(v);
                    this._tileCountY++;
                }
                this._tileCountX = H - u + 1;
            }
        } else {
            var E = this._originX - this._oldOriginX;
            var C = this._originY - this._oldOriginY;
            this._repositionImage(E, C);
            var e = this._scale;
            this._minXIndex = Math.floor(D / this._tileSize) - this._cachedCycleCount;
            this._minYIndex = Math.floor(B / this._tileSize) - this._cachedCycleCount;
            var j = Math.floor((D + this._width) / this._tileSize) + this._cachedCycleCount;
            var s = Math.floor((B + this._height) / this._tileSize) + this._cachedCycleCount;
            var q = 0;
            var n = 0;
            this._minXIndex += q;
            this._minYIndex += n;
            while (this._tileStartX < this._minXIndex) {
                for (var l = this._tiles.length - 1; l >= 0; l--) {
                    var I = this._tiles[l].shift();
                    if (I) {
                        this._removeTileFromMap(I);
                    }
                    I = null;
                }
                this._tileCountX--;
                this._tileStartX++;
            }
            while (this._tileStartX > this._minXIndex) {
                this._tileStartX--;
                this._tileCountX++;
                for (var l = 0; l < this._tiles.length; l++) {
                    var I = this._createTile(this._tileStartX, this._tileStartY + l, this._resolution, this._originX, this._originY);
                    this._tiles[l].unshift(I);
                    I = null;
                }
            }
            while (this._tileEndX > j) {
                for (var l = 0; l < this._tiles.length; l++) {
                    var I = this._tiles[l].pop();
                    if (I) {
                        this._removeTileFromMap(I);
                    }
                    I = null;
                }
                this._tileEndX--;
                this._tileCountX--;
            }
            while (this._tileEndX < j) {
                this._tileEndX++;
                this._tileCountX++;
                for (var l = 0; l < this._tiles.length; l++) {
                    var I = this._createTile(this._tileEndX, this._tileStartY + l, this._resolution, this._originX, this._originY);
                    this._tiles[l].push(I);
                    I = null;
                }
            }
            while (this._tileStartY < this._minYIndex) {
                var v = this._tiles.shift();
                if (v) {
                    while (v.length > 0) {
                        var I = v.pop();
                        this._removeTileFromMap(I);
                        I = null;
                    }
                    v = null;
                }
                this._tileStartY++;
                this._tileCountY--;
            }
            while (this._tileStartY > this._minYIndex) {
                this._tileStartY--;
                this._tileCountY++;
                var v = new Array();
                for (var z = 0; z < this._tileCountX; z++) {
                    var I = this._createTile(this._tileStartX + z, this._tileStartY, this._resolution, this._originX, this._originY);
                    v.push(I);
                    I = null;
                }
                this._tiles.unshift(v);
            }
            while (this._tileEndY > s) {
                var v = this._tiles.pop();
                while (v.length > 0) {
                    var I = v.pop();
                    if (I) {
                        this._removeTileFromMap(I);
                    }
                    I = null;
                }
                this._tileEndY--;
                this._tileCountY--;
            }
            while (this._tileEndY < s) {
                this._tileEndY++;
                this._tileCountY++;
                var v = new Array();
                for (var p = 0; p < this._tileCountX; p++) {
                    var I = this._createTile(this._tileStartX + p, this._tileEndY, this._resolution, this._originX, this._originY);
                    v.push(I);
                    I = null;
                }
                this._tiles.push(v);
            }
        }
    },
    _createTile: function(b, i, e, m, k) {
        var o = new Object();
        o.tileSize = this._tileSize;
        var d = b + "," + i + "," + e;
        o._image = this._getBufferedImage(d);
        o.xIndex = b;
        o.yIndex = i;
        o.posX = b * this._tileSize - m;
        o.posY = i * this._tileSize - k;
        if (o._image == null) {
            o._imageSrc = this._getTileUrl(b, i, e);
            o._image = new Image(this._tileSize, this._tileSize);
            o._image.id = d;
            o._image.src = o._imageSrc;
            var l = o._image.style;
            l.position = "absolute";
            l.left = o.posX + "px";
            l.top = o.posY + "px";
            o._image.style.MozUserSelect = "none";
            o._image.ondrag = function() { return false; };
            o._image.ondragend = function() { return false; };
            o._image.onmousedown = function() { return false; };
            if (SuperMap.Web.Utility.GetBrowser() == "ie") {
                if (this._containerNum == 0) {
                    this._container.appendChild(o._image);
                } else {
                    this._container1.appendChild(o._image);
                }
            } else {
                o._image.onload = this._tileSetFactorDelegate;
            }
            o.id = d;
            if (this._imageOpacity < 100) {
                if (SuperMap.Web.Utility.GetBrowser() == "ie") {
                    o._image.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (this._imageOpacity) + ")";
                }
            }
            if (this._enableImageBuffer) {
                if (this._imageBuffer.length > this._cachedTileCount) {
                    var g = this._imageBuffer.length;
                    var f = 0;
                    var n = this._cachedTileCount / 4;
                    var h = 0;
                    var a = 0;
                    while (h < g) {
                        if (this._imageBuffer[a].index < n) {
                            var c = this._imageBuffer.splice(a, 1)[0];
                            c.image.onload = null;
                            c.image.onerror = null;
                            c.image.onmousedown = null;
                            delete c;
                            c = null;
                        } else {
                            this._imageBuffer[a].index -= n;
                            a++;
                        }
                        h++;
                    }
                    this._index -= n;
                }
                if (o._image && this._getBufferedImage(o.id) == null) {
                    if (!this._index) {
                        this._index = 0;
                    }
                    var p = new Object();
                    p.image = o._image;
                    p.id = o.id;
                    p.index = this._index++;
                    this._imageBuffer.push(p);
                }
            }
        } else {
            if (this._containerNum == 0) {
                this._container.appendChild(o._image);
            } else {
                this._container1.appendChild(o._image);
            }
            o.id = o._image.id;
            o._imageSrc = o._image.src;
            o._image._loaded = true;
            var l = o._image.style;
            l.left = o.posX + "px";
            l.top = o.posY + "px";
        }
        return o;
    }
};
SuperMap.Web.Mapping.TiledCachedLayer.registerClass("SuperMap.Web.Mapping.TiledCachedLayer", SuperMap.Web.Mapping.TiledLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.TiledDynamicLayer = function() { SuperMap.Web.Mapping.TiledDynamicLayer.initializeBase(this); };
SuperMap.Web.Mapping.TiledDynamicLayer.prototype = {
    getTileUrl: function(b, a, c) {
    },
    _initializeLoadTile: function() {
        var C = this._originX;
        var A = this._originY;
        if (!this._cachedCycleCount && this._cachedCycleCount != 0) {
            this._cachedCycleCount = 1;
        }
        if (!this._tileSize) {
            this._tileSize = 256;
        }
        if ((!this._tiles) || (this._tiles.length == 0) || this._verifyReload(C, A)) {
            this._clearTiles();
            this._tiles = new Array();
            var t = Math.floor(C / this._tileSize) - this._cachedCycleCount;
            var s = Math.floor(A / this._tileSize) - this._cachedCycleCount;
            this._tileStartX = t;
            this._tileStartY = s;
            var G = Math.floor(((C + this._width) / this._tileSize) + this._cachedCycleCount);
            var F = Math.floor(((A + this._height) / this._tileSize) + this._cachedCycleCount);
            this._tileEndX = G;
            this._tileEndY = F;
            var h = G - t + 1;
            var g = F - s + 1;
            this._tileCount = h * g;
            var e = this._scale;
            if (this._enableSpiralLoad) {
                var d = new Array();
                for (var l = s; l <= F; l++) {
                    var u = new Array();
                    for (var o = t; o <= G; o++) {
                        var H = new Object();
                        H.x = o;
                        H.y = l;
                        H.queued = false;
                        u.push(H);
                    }
                    d.push(u);
                    var n = new Array();
                    this._tiles.push(n);
                }
                var a = new Array();
                var q = ["right", "down", "left", "up"];
                var f = 0;
                var c = -1;
                var E = 0;
                var z = 0;
                while (z < q.length) {
                    var v = f;
                    var k = c;
                    switch (q[E]) {
                    case "right":
                        k++;
                        break;
                    case "down":
                        v++;
                        break;
                    case "left":
                        k--;
                        break;
                    case "up":
                        v--;
                        break;
                    }
                    var H = null;
                    if ((v < g) && (v >= 0) && (k < h) && (k >= 0)) {
                        H = d[v][k];
                    }
                    if ((H != null) && (!H.queued)) {
                        a.unshift(H);
                        H.queued = true;
                        z = 0;
                        f = v;
                        c = k;
                    } else {
                        E = (E + 1) % 4;
                        z++;
                    }
                }
                for (var w = 0; w < a.length; w++) {
                    var b = a[w];
                    var H = this._createTile(b.x, b.y, this._scale, C, A);
                    this._tiles[b.y - s][b.x - t] = H;
                }
                a = null;
                while (d.length > 0) {
                    var u = d.pop();
                    while (u.length > 0) {
                        var b = u.pop();
                        b = null;
                    }
                    u = null;
                }
                d = null;
            } else {
                for (var l = s; l <= F; l++) {
                    var u = new Array();
                    for (var o = t; o <= G; o++) {
                        var H = this._createTile(o, l, this._scale, C, A);
                        u.push(H);
                    }
                    this._tiles.push(u);
                    this._tileCountY++;
                }
                this._tileCountX = G - t + 1;
            }
        } else {
            var D = this._originX - this._oldOriginX;
            var B = this._originY - this._oldOriginY;
            this._repositionImage(D, B);
            var e = this._scale;
            this._minXIndex = Math.floor(C / this._tileSize) - this._cachedCycleCount;
            this._minYIndex = Math.floor(A / this._tileSize) - this._cachedCycleCount;
            var j = Math.floor((C + this._width) / this._tileSize) + this._cachedCycleCount;
            var r = Math.floor((A + this._height) / this._tileSize) + this._cachedCycleCount;
            var p = 0;
            var m = 0;
            this._minXIndex += p;
            this._minYIndex += m;
            while (this._tileStartX < this._minXIndex) {
                for (var l = this._tiles.length - 1; l >= 0; l--) {
                    var H = this._tiles[l].shift();
                    if (H) {
                        this._removeTileFromMap(H);
                    }
                    H = null;
                }
                this._tileCountX--;
                this._tileStartX++;
            }
            while (this._tileStartX > this._minXIndex) {
                this._tileStartX--;
                this._tileCountX++;
                for (var l = 0; l < this._tiles.length; l++) {
                    var H = this._createTile(this._tileStartX, this._tileStartY + l, this._scale, this._originX, this._originY);
                    this._tiles[l].unshift(H);
                    H = null;
                }
            }
            while (this._tileEndX > j) {
                for (var l = 0; l < this._tiles.length; l++) {
                    var H = this._tiles[l].pop();
                    if (H) {
                        this._removeTileFromMap(H);
                    }
                    H = null;
                }
                this._tileEndX--;
                this._tileCountX--;
            }
            while (this._tileEndX < j) {
                this._tileEndX++;
                this._tileCountX++;
                for (var l = 0; l < this._tiles.length; l++) {
                    var H = this._createTile(this._tileEndX, this._tileStartY + l, this._scale, this._originX, this._originY);
                    this._tiles[l].push(H);
                    H = null;
                }
            }
            while (this._tileStartY < this._minYIndex) {
                var u = this._tiles.shift();
                if (u) {
                    while (u.length > 0) {
                        var H = u.pop();
                        this._removeTileFromMap(H);
                        H = null;
                    }
                    u = null;
                }
                this._tileStartY++;
                this._tileCountY--;
            }
            while (this._tileStartY > this._minYIndex) {
                this._tileStartY--;
                this._tileCountY++;
                var u = new Array();
                for (var w = 0; w < this._tileCountX; w++) {
                    var H = this._createTile(this._tileStartX + w, this._tileStartY, this._scale, this._originX, this._originY);
                    u.push(H);
                    H = null;
                }
                this._tiles.unshift(u);
            }
            while (this._tileEndY > r) {
                var u = this._tiles.pop();
                while (u.length > 0) {
                    var H = u.pop();
                    if (H) {
                        this._removeTileFromMap(H);
                    }
                    H = null;
                }
                this._tileEndY--;
                this._tileCountY--;
            }
            while (this._tileEndY < r) {
                this._tileEndY++;
                this._tileCountY++;
                var u = new Array();
                for (var o = 0; o < this._tileCountX; o++) {
                    var H = this._createTile(this._tileStartX + o, this._tileEndY, this._scale, this._originX, this._originY);
                    u.push(H);
                    H = null;
                }
                this._tiles.push(u);
            }
        }
    },
    _createTile: function(b, i, e, m, k) {
        var o = new Object();
        o.tileSize = this._tileSize;
        var d = b + "," + i + "," + e;
        o._image = this._getBufferedImage(d);
        o.xIndex = b;
        o.yIndex = i;
        o.posX = b * this._tileSize - m;
        o.posY = i * this._tileSize - k;
        if (o._image == null) {
            o._imageSrc = this._getTileUrl(b, i, e);
            o._image = new Image(this._tileSize, this._tileSize);
            o._image.id = d;
            o._image.src = o._imageSrc;
            var l = o._image.style;
            l.position = "absolute";
            l.left = o.posX + "px";
            l.top = o.posY + "px";
            o._image.style.MozUserSelect = "none";
            o._image.ondrag = function() { return false; };
            o._image.ondragend = function() { return false; };
            o._image.onmousedown = function() { return false; };
            if (SuperMap.Web.Utility.GetBrowser() == "ie") {
                if (this._containerNum == 0) {
                    this._container.appendChild(o._image);
                } else {
                    this._container1.appendChild(o._image);
                }
            } else {
                o._image.onload = this._tileSetFactorDelegate;
            }
            o.id = d;
            if (this._imageOpacity < 100) {
                if (SuperMap.Web.Utility.GetBrowser() == "ie") {
                    o._image.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (this._imageOpacity) + ")";
                }
            }
            if (this._enableImageBuffer) {
                if (this._imageBuffer.length > this._cachedTileCount) {
                    var g = this._imageBuffer.length;
                    var f = 0;
                    var n = this._cachedTileCount / 4;
                    var h = 0;
                    var a = 0;
                    while (h < g) {
                        if (this._imageBuffer[a].index < n) {
                            var c = this._imageBuffer.splice(a, 1)[0];
                            c.image.onload = null;
                            c.image.onerror = null;
                            c.image.onmousedown = null;
                            delete c;
                            c = null;
                        } else {
                            this._imageBuffer[a].index -= n;
                            a++;
                        }
                        h++;
                    }
                    this._index -= n;
                }
                if (o._image && this._getBufferedImage(o.id) == null) {
                    if (!this._index) {
                        this._index = 0;
                    }
                    var p = new Object();
                    p.image = o._image;
                    p.id = o.id;
                    p.index = this._index++;
                    p.src = o._image.src;
                    this._imageBuffer.push(p);
                }
            }
        } else {
            if (this._containerNum == 0) {
                this._container.appendChild(o._image);
            } else {
                this._container1.appendChild(o._image);
            }
            o.id = o._image.id;
            o._imageSrc = o._image.src;
            o._image._loaded = true;
            var l = o._image.style;
            l.left = o.posX + "px";
            l.top = o.posY + "px";
        }
        return o;
    }
};
SuperMap.Web.Mapping.TiledDynamicLayer.registerClass("SuperMap.Web.Mapping.TiledDynamicLayer", SuperMap.Web.Mapping.TiledLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.TiledWMSLayer = function() {
    SuperMap.Web.Mapping.TiledWMSLayer.initializeBase(this);
    this._layers = null;
    this._version = null;
    this._crs = null;
    this._bgColor = "";
    this._transparent = true;
    this._time = null;
    this._exceptions = null;
    this._elevation = null;
    this._latLongCRSRanges = [[4001, 4999], [2044, 2045], [2081, 2083], [2085, 2086], [2093, 2093], [2096, 2098], [2105, 2132], [2169, 2170], [2176, 2180], [2193, 2193], [2200, 2200], [2206, 2212], [2319, 2319], [2320, 2462], [2523, 2549], [2551, 2735], [2738, 2758], [2935, 2941], [2953, 2953], [3006, 3030], [3034, 3035], [3058, 3059], [3068, 3068], [3114, 3118], [3126, 3138], [3300, 3301], [3328, 3335], [3346, 3346], [3350, 3352], [3366, 3366], [3416, 3416], [20004, 20032], [20064, 20092], [21413, 21423], [21473, 21483], [21896, 21899], [22171, 22177], [22181, 22187], [22191, 22197], [25884, 25884], [27205, 27232], [27391, 27398], [27492, 27492], [28402, 28432], [28462, 28492], [30161, 30179], [30800, 30800], [31251, 31259], [31275, 31279], [31281, 31290], [31466, 31700]];
    this._dynamicImage = null;
    this._width = null;
    this._height = null;
    this._type = "TiledWMSLayer";
};
SuperMap.Web.Mapping.TiledWMSLayer.prototype = {
    get_layers: function() { return this._layers; },
    set_layers: function(a) { this._layers = a; },
    get_version: function() { return this._version; },
    set_version: function(a) { this._version = a; },
    get_transparent: function() { return this._transparent; },
    set_transparent: function(a) { this._transparent = a; },
    get_crs: function() { return this._crs; },
    set_crs: function(a) { this._crs = a; },
    get_bgColor: function() { return this._bgColor; },
    set_bgColor: function(a) { this._bgColor = a; },
    set_bounds: function(a) {
        var b = Function._validateParams(arguments, [{ name: "bounds", type: SuperMap.Web.Core.Rectangle2D }]);
        if (b) {
            throw b;
        }
        this._bounds = a;
    },
    _getTileUrl: function(i, h, d) {
        if (!this._url || !this._layers || !this._version || !this._crs) {
            throw new Error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "DynamicWMSLayer_getImageUrl_VariableIllegal"));
        }
        if (!this._viewBounds || this._viewBounds.isEmpty()) {
            this._viewBounds = this._map.get_viewBounds().clone();
        }
        var e = this._crs.wkid;
        var f = "";
        f = f + this._url + "?service=WMS&request=GetMap&width=" + this._tileSize + "&height=" + this._tileSize + "&format=image/" + this._imageFormat + "&layers=" + this._layers.toString() + "&styles=&bgcolor=" + this._bgColor + "&transparent=" + this._transparent + "&version=" + this._version;
        var a = this._getBBox(i, h);
        switch (this._version) {
        case "1.1.1":
            f = f + "&SRS=EPSG:" + e + "&bbox=" + a.leftBottom.x + "," + a.leftBottom.y + "," + a.rightTop.x + "," + a.rightTop.y;
            break;
        case "1.3":
        case "1.3.0":
            f = f + "&CRS=EPSG:" + e;
            var c = false;
            var b = this._latLongCRSRanges.length;
            for (var g = 0; g < b; g++) {
                if (e >= this._latLongCRSRanges[g][0] && e <= this._latLongCRSRanges[g][1]) {
                    c = true;
                    break;
                }
            }
            if (c) {
                f = f + "&bbox=" + a.leftBottom.y + "," + a.leftBottom.x + "," + a.rightTop.y + "," + a.rightTop.x;
            } else {
                f = f + "&bbox=" + a.leftBottom.x + "," + a.leftBottom.y + "," + a.rightTop.x + "," + a.rightTop.y;
            }
            break;
        }
        return f;
    },
    _getBBox: function(b, a) {
        left = this._bounds.leftBottom.x + this._tileSize * b * this._resolution;
        right = this._bounds.leftBottom.x + this._tileSize * (b + 1) * this._resolution;
        top = this._bounds.rightTop.y - this._tileSize * (a) * this._resolution;
        bottom = this._bounds.rightTop.y - this._tileSize * (a + 1) * this._resolution;
        return new SuperMap.Web.Core.Rectangle2D(left, bottom, right, top);
    }
};
SuperMap.Web.Mapping.TiledWMSLayer.registerClass("SuperMap.Web.Mapping.TiledWMSLayer", SuperMap.Web.Mapping.TiledDynamicLayer);
SuperMap.Web.Mapping.TiledGMapsLayer = function() {
    SuperMap.Web.Mapping.TiledGMapsLayer.initializeBase(this);
    this._subDomains = [0, 1, 2, 3];
    this._mapTileUri = "http://mt{0}.google.com/mt/v=ap.92&hl=zh-CN&z={1}&x={2}&y={3}&s=";
    this._satelliteTileUri = "http://khm{0}.google.com/maptilecompress/t=3&q=25&hl=zh-CN&x={2}&y={3}&z={1}&s=Gal";
    this._cornerCoordinate = 20037508.3427892;
    this._wkid = 102113;
    this._mapType = "map";
};
SuperMap.Web.Mapping.TiledGMapsLayer.prototype = {
    get_mapType: function() { return this._mapType; },
    set_mapType: function(a) { this._mapType = a; },
    _getTileUrl: function(a, h, c) {
        var f = Function._validateParams(arguments, [{ name: "x", type: Number }, { name: "y", type: Number }, { name: "resolution", type: Number }]);
        if (f) {
            throw f;
        }
        var b = null;
        var g = this._map.get_level();
        if (a < 0 || h < 0 || a > Math.pow(2, g) - 1 || h > Math.pow(2, g) - 1) {
            b = "images/blank_256.png";
            return b;
        }
        var d = this._subDomains[(a + h + g) % this._subDomains.length];
        switch (this._mapType) {
        case "map":
            b = "http://mt" + d + ".google.cn/vt/v=w2.106&hl=zh-CN&gl=cn&z=" + g + "&x=" + a + "&y=" + h + "&s=G";
            break;
        case "satellite":
            b = "http://khm" + d + ".google.com/kh/v=45&x=" + a + "&y=" + h + "&z=" + g + "&s=Gal";
            break;
        case "communication":
            b = "http://mt" + d + ".google.cn/vt/v=w2t.106&hl=zh-CN&gl=cn&x=" + a + "&y=" + h + "&z=" + g + "&s=Galile";
            break;
        }
        return b;
    },
    initialize: function() {
        this._bounds = new SuperMap.Web.Core.Rectangle2D(-this._cornerCoordinate, -this._cornerCoordinate, this._cornerCoordinate, this._cornerCoordinate);
        this._tileSize = 256;
        var c = this._cornerCoordinate * 2 / 256;
        var a = new Array();
        for (var b = 0; b < 22; b++) {
            a[b] = c;
            c *= 0.5;
        }
        this._resolutions = a;
        this._url = this._mapTileUri;
        this._viewBoundsChangedDelegate = Function.createDelegate(this, this._viewBoundsChanged);
        this._unLoadDelegate = Function.createDelegate(this, this._unLoad);
        this._crs = new SuperMap.Web.Core.CoordinateReferenceSystem(3857, "undefined");
        this._initialized = true;
        this.raise_initialized(this);
    },
    setMap: function(a) {
        this._map = a;
        this._viewBounds = this._map.get_viewBounds().clone();
        this._map.add_viewBoundsChanged(this._viewBoundsChangedDelegate);
        this._map.add_layerRemoved(this._unLoadDelegate);
    },
    add_refreshing: function(a) { this._addEvent("refreshing", a); },
    remove_refreshing: function(a) { this._removeEvent("refreshing", a); },
    raise_refreshing: function(a, b) { this._raiseEvent("refreshing", a, b); },
    _addEvent: function(a, b) { this.get_events().addHandler(a, b); },
    _removeEvent: function(a, b) { this.get_events().removeHandler(a, b); },
    _raiseEvent: function(a, c, d) {
        var b = this.get_events().getHandler(a);
        if (b) {
            b(c, d);
        }
    }
};
SuperMap.Web.Mapping.TiledGMapsLayer.registerClass("SuperMap.Web.Mapping.TiledGMapsLayer", SuperMap.Web.Mapping.TiledCachedLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.FeaturesLayer = function() {
    SuperMap.Web.Mapping.FeaturesLayer.initializeBase(this);
    this._features = new Array();
    this._style = null;
    this._featuresSum = 0;
    this._viewBoundsChangedDelegate = Function.createDelegate(this, this._viewBoundsChanged);
    this._unLoadDelegate = Function.createDelegate(this, this._unLoad);
};
SuperMap.Web.Mapping.FeaturesLayer.prototype = {
    get_features: function() { return this._features; },
    get_style: function() { return this._style; },
    set_style: function(a) { this._style = a; },
    setMap: function(b) {
        var a = Function._validateParams(arguments, [{ name: "map", type: SuperMap.Web.Mapping.MapControl }]);
        if (a) {
            throw a;
        }
        this._map = b;
        this._viewBounds = this._map.get_viewBounds().clone();
        this._map.add_viewBoundsChanged(this._viewBoundsChangedDelegate);
    },
    draw: function() {
        this._applyVisible();
        var a = this._map._computeOrigin(this._bounds);
        this._originX = -1 * a.x;
        this._originY = -1 * a.y;
        if (this._features && this._features.length > 0) {
            this.clear();
            var c = null;
            for (var b = 0; b < this._features.length; b++) {
                c = this._features[b];
                if (!!this._style) {
                    this._drawGeometry(c.id, c.geometry, this._style, c.title);
                } else {
                    this._drawGeometry(c.id, c.geometry, c.style, c.title);
                }
            }
        }
        this._firstOriginX = this._originX;
        this._firstOriginY = this._originY;
    },
    addFeature: function(c) {
        if (this._features) {
            for (var b = 0; b < this._features.length; b++) {
                if (this._features[b].id && (c.id == this._features[b].id)) {
                    return false;
                }
            }
        }
        if (this._features == null) {
            this._features = new Array();
        }
        this._features.push(c);
        this._featuresSum++;
        this._checkBounds(c.geometry);
        var e = c.geometry;
        var d = c.style;
        var a = c.attributes;
        var f = c.id;
        if (!f) {
            c.id = "features_" + this._featuresSum;
        }
        if (!this._style && e) {
            if (c.style.pointRadius != 6 || c.style.stroke != true || c.style.fill != true || c.style.strokeColor != "green" || c.style.lineWidth != 2 || c.style.lineJoin != null || c.style.fillColor != "red" || c.style.opacity != 1) {
                this._drawGeometry(c.id, e, d, c.title);
            } else {
                if (this._map.get_theme()) {
                    c.style.fill = true;
                    c.style.stroke = true;
                    c.style.strokeColor = this._map.get_theme().get_stroke();
                    c.style.lineWidth = this._map.get_theme().get_strokeThickness();
                    c.style.pointRadius = this._map.get_theme().get_size();
                    c.style.fillColor = this._map.get_theme().get_color();
                    c.style.opacity = this._map.get_theme().get_opacity();
                }
                this._drawGeometry(c.id, e, d, c.title);
            }
        } else {
            this._drawGeometry(c.id, e, this._style, c.title);
        }
    },
    refresh: function() {
        this.clear();
        this.draw();
    },
    _drawGeometry: function(d, c, a, b) {
        if (SuperMap.Web.Core.GeoPoint.isInstanceOfType(c)) {
            this.drawPoint(d, c, a, b);
            return;
        }
        if (SuperMap.Web.Core.GeoLine.isInstanceOfType(c)) {
            if (a) {
                a.fill = false;
                a.stroke = true;
            }
            this.drawLine(d, c, a, b);
            return;
        }
        if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(c)) {
            this.drawPolygon(d, c, a, b);
            return;
        }
        if (SuperMap.Web.Core.GeoEllipse.isInstanceOfType(c)) {
            this.drawEllipse(d, c, a, c.lRadius, c.sRadius, b);
            return;
        }
        if (SuperMap.Web.Core.GeoCircle.isInstanceOfType(c)) {
            this.drawCircle(d, c, a, b);
            return;
        }
    },
    initialize: function() { throw new Error("未实现异常"); },
    drawPoint: function(d, c, a, b) { throw new Error("未实现异常"); },
    drawLine: function(d, c, a, b) { throw new Error("未实现异常"); },
    drawPolygon: function(d, c, a, b) { throw new Error("未实现异常"); },
    clear: function() { throw new Error("未实现异常"); },
    clearFeatures: function(a) { throw new Error("未实现异常"); },
    _viewBoundsChanged: function() {
        var m = this._map._computeOrigin(this._bounds);
        this._originX = -1 * m.x;
        this._originY = -1 * m.y;
        this._viewBounds = this._map.get_viewBounds().clone();
        var j = this._map.get_isZooming();
        if (j) {
            this.clear();
            var d, k, b, l;
            if (this._features != null) {
                var e = this._features.length;
                for (var g = 0; g < e; g++) {
                    k = this._features[g].geometry;
                    b = this._features[g].style;
                    l = this._features[g].title;
                    d = this._features[g].id;
                    if (!k) {
                        continue;
                    }
                    if (!this._style) {
                        this._drawGeometry(d, k, b, l);
                    } else {
                        this._drawGeometry(d, k, this._style, l);
                    }
                }
            }
            this._firstOriginX = this._originX;
            this._firstOriginY = this._originY;
        } else {
            if (this._map._panActionMark) {
                var h = this._originX - this._firstOriginX;
                var f = this._originY - this._firstOriginY;
                var c = this._pxToNum(this._container.style.left) - h;
                var a = this._pxToNum(this._container.style.top) - f;
                this._container.style.left = c + "px";
                this._container.style.top = a + "px";
                this._firstOriginX = this._originX;
                this._firstOriginY = this._originY;
            } else {
                this._container.style.left = "0px";
                this._container.style.top = "0px";
                this.draw();
            }
        }
    },
    _unLoad: function() { this._container.parentNode.removeChild(this._container); },
    _checkBounds: function(a) {
        if (this._bounds.isEmpty()) {
            if (a.bounds().isEmpty()) {
                if (SuperMap.Web.Utility.isDebug) {
                    console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.Mapping.Resources", "Map_checkBounds_boundsNull"));
                }
                return false;
            }
        }
        if (a.bounds().leftBottom.x || a.bounds().leftBottom.x == 0) {
            if (isNaN(this._bounds.leftBottom.x)) {
                this._bounds.leftBottom.x = a.bounds().leftBottom.x;
            } else {
                this._bounds.leftBottom.x = this._bounds.leftBottom.x < a.bounds().leftBottom.x ? this._bounds.leftBottom.x : a.bounds().leftBottom.x;
            }
        }
        if (a.bounds().leftBottom.y || a.bounds().leftBottom.y == 0) {
            if (isNaN(this._bounds.leftBottom.y)) {
                this._bounds.leftBottom.y = a.bounds().leftBottom.y;
            } else {
                this._bounds.leftBottom.y = this._bounds.leftBottom.y < a.bounds().leftBottom.y ? this._bounds.leftBottom.y : a.bounds().leftBottom.y;
            }
        }
        if (a.bounds().rightTop.x || a.bounds().rightTop.x == 0) {
            if (isNaN(this._bounds.rightTop.x)) {
                this._bounds.rightTop.x = a.bounds().rightTop.x;
            } else {
                this._bounds.rightTop.x = this._bounds.rightTop.x > a.bounds().rightTop.x ? this._bounds.rightTop.x : a.bounds().rightTop.x;
            }
        }
        if (a.bounds().rightTop.y || a.bounds().rightTop.y == 0) {
            if (isNaN(this._bounds.rightTop.y)) {
                this._bounds.rightTop.y = a.bounds().rightTop.y;
            } else {
                this._bounds.rightTop.y = this._bounds.rightTop.y > a.bounds().rightTop.y ? this._bounds.rightTop.y : a.bounds().rightTop.y;
            }
        }
    }
};
SuperMap.Web.Mapping.FeaturesLayer.registerClass("SuperMap.Web.Mapping.FeaturesLayer", SuperMap.Web.Mapping.Layer);
SuperMap.Web.Mapping.FeaturesLayerFactory = function() { throw new Error("未实现异常"); };
SuperMap.Web.Mapping.FeaturesLayerFactory.registerClass("SuperMap.Web.Mapping.FeaturesLayerFactory", null, Sys.IDisposable);
SuperMap.Web.Mapping.FeaturesLayerFactory.make = function(a) {
    if (!a) {
        if (Sys.Browser.name != "Microsoft Internet Explorer") {
            return $create(SuperMap.Web.Mapping.SVGLayer, null, null, null, null);
        } else {
            return $create(SuperMap.Web.Mapping.VMLLayer, null, null, null, null);
        }
    }
    if (Sys.Browser.name != "Microsoft Internet Explorer") {
        return $create(SuperMap.Web.Mapping.SVGLayer, { style: a }, null, null, null);
    } else {
        return $create(SuperMap.Web.Mapping.VMLLayer, { style: a }, null, null, null);
    }
    return null;
};
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.SVGLayer = function() {
    SuperMap.Web.Mapping.SVGLayer.initializeBase(this);
    this._SVGDoc = null;
    this._featuresSum = 0;
    this._type = "SVGLayer";
};
SuperMap.Web.Mapping.SVGLayer.prototype = {
    set_container: function(a) {
        var b = Function._validateParams(arguments, [{ name: "container", domElement: true }]);
        if (b) {
            throw b;
        }
        this._container = a;
        this._container.appendChild(this._SVGDoc);
    },
    dispose: function() {
        while (this._SVGDoc.childNodes.length > 0) {
            while (this._SVGDoc.firstChild.childNodes.length > 0) {
                this._SVGDoc.firstChild.removeChild(this._SVGDoc.firstChild.firstChild);
            }
            this._SVGDoc.removeChild(this._SVGDoc.firstChild);
        }
        this._SVGDoc = null;
    },
    initialize: function() {
        this._SVGDoc = document.createElementNS("http://www.w3.org/2000/svg", "svg");
        this._initialized = true;
    },
    modifyFeature: function(f, e, c, d) {
        for (var b = 0; b < this._features.length; b++) {
            if (this._features[b].id == f) {
                var a = this._features[b];
            }
        }
        if (e) {
            a.geometry = e;
        }
        if (d) {
            a.title = d;
        }
        if (c) {
            a.style = c;
        }
        this._updateFeature(a);
    },
    clearFeatures: function(b) {
        if (b instanceof Array) {
            for (var a = b.length - 1; a >= 0; a--) {
                this.clearFeature(b[a].id);
            }
        } else {
            while (this._features.length > 0) {
                this._features.pop();
            }
            this.clear();
        }
        this._featuresSum = 0;
    },
    clearFeature: function(b) {
        if (b) {
            for (var a = 0; a < this._features.length; a++) {
                if (this._features[a].id == b) {
                    this._features.splice(a, 1);
                    this._featuresSum--;
                    this._SVGDoc.removeChild(document.getElementById(b));
                    return;
                }
            }
        }
    },
    clear: function() {
        if (this._SVGDoc.hasChildNodes()) {
            while (this._SVGDoc.childNodes.length > 0) {
                this._SVGDoc.removeChild(this._SVGDoc.childNodes[0]);
            }
        }
    },
    drawPoint: function(g, f, c, e) {
        if (typeof(f) == "undefined") {
            alert("geometry is null");
            return;
        }
        var b = c.pointRadius;
        var a = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(f.x, f.y));
        var d = document.createElementNS("http://www.w3.org/2000/svg", "circle");
        d.setAttribute("id", g);
        d.setAttribute("cx", "" + a.x);
        d.setAttribute("cy", "" + a.y);
        d.setAttribute("r", "" + b);
        if (typeof(c) == "undefined" || !c) {
            d.setAttribute("stroke", "red");
            d.setAttribute("fill", "red");
        } else {
            if (c.stroke) {
                d.setAttribute("stroke-opacity", 1);
                if (c.strokeColor) {
                    d.setAttribute("stroke", c.strokeColor);
                }
                if (c.lineWidth) {
                    d.setAttribute("stroke-width", c.lineWidth);
                }
            } else {
                d.setAttribute("stroke-opacity", 0);
            }
            if (c.fill) {
                d.setAttribute("fill-opacity", 1);
                if (c.fillColor) {
                    d.setAttribute("fill", c.fillColor);
                }
            } else {
                d.setAttribute("fill-opacity", 0);
            }
            if (c.opacity) {
                d.setAttribute("opacity", c.opacity);
            }
        }
        if (typeof(e) != "undefined") {
            d.setAttribute("title", e);
        }
        this._SVGDoc.appendChild(d);
    },
    drawCircle: function(g, f, c, e) {
        if (typeof(f) == "undefined") {
            alert("geometry is null");
            return;
        }
        var b = f.geoRadius / this._map._resolution;
        var a = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(f.center.x, f.center.y));
        var d = document.createElementNS("http://www.w3.org/2000/svg", "circle");
        d.setAttribute("id", g);
        d.setAttribute("cx", "" + a.x);
        d.setAttribute("cy", "" + a.y);
        d.setAttribute("r", "" + b);
        if (typeof(c) == "undefined" || !c) {
            d.setAttribute("stroke", "red");
            d.setAttribute("fill", "red");
        } else {
            if (c.stroke) {
                d.setAttribute("stroke-opacity", 1);
                if (c.strokeColor) {
                    d.setAttribute("stroke", c.strokeColor);
                }
                if (c.lineWidth) {
                    d.setAttribute("stroke-width", c.lineWidth);
                }
            } else {
                d.setAttribute("stroke-opacity", 0);
            }
            if (c.fill) {
                d.setAttribute("fill-opacity", 1);
                if (c.fillColor) {
                    d.setAttribute("fill", c.fillColor);
                }
            } else {
                d.setAttribute("fill-opacity", 0);
            }
            if (c.opacity) {
                d.setAttribute("opacity", c.opacity);
            }
        }
        if (typeof(e) != "undefined") {
            d.setAttribute("title", e);
        }
        this._SVGDoc.appendChild(d);
    },
    drawEllipse: function(h, g, c, f) {
        if (typeof(g) == "undefined") {
            alert("geometry is null");
            return;
        }
        var e = g.xGeoRadius / this._map._resolution;
        var b = g.yGeoRadius / this._map._resolution;
        var a = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(g.center.x, g.center.y));
        var d = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
        d.setAttribute("id", h);
        d.setAttribute("cx", "" + a.x);
        d.setAttribute("cy", "" + a.y);
        d.setAttribute("rx", "" + e);
        d.setAttribute("ry", "" + b);
        if (typeof(c) == "undefined" || !c) {
            d.setAttribute("stroke", "red");
            d.setAttribute("fill", "red");
        } else {
            if (c.stroke) {
                d.setAttribute("stroke-opacity", 1);
                if (c.strokeColor) {
                    d.setAttribute("stroke", c.strokeColor);
                }
                if (c.lineWidth) {
                    d.setAttribute("stroke-width", c.lineWidth);
                }
            } else {
                d.setAttribute("stroke-opacity", 0);
            }
            if (c.fill) {
                d.setAttribute("fill-opacity", 1);
                if (c.fillColor) {
                    d.setAttribute("fill", c.fillColor);
                }
            } else {
                d.setAttribute("fill-opacity", 0);
            }
            if (c.opacity) {
                d.setAttribute("opacity", c.opacity);
            }
        }
        if (typeof(f) != "undefined") {
            d.setAttribute("title", f);
        }
        this._SVGDoc.appendChild(d);
    },
    drawLine: function(b, h, a, l) {
        if (typeof(h) == "undefined") {
            alert("geometry is null");
            return;
        }
        if (h.parts.length > 1) {
            var f = document.createElementNS("http://www.w3.org/2000/svg", "g");
            f.setAttribute("id", b);
            this._SVGDoc.appendChild(f);
            for (var d = 0; d < h.parts.length; d++) {
                var m = document.createElementNS("http://www.w3.org/2000/svg", "polyline");
                f.appendChild(m);
                var k = "";
                for (var c = 0; c < h.parts[d].length; c++) {
                    var n = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(h.parts[d][c].x, h.parts[d][c].y));
                    k += n.x + "," + n.y + " ";
                }
                m.setAttribute("points", k);
                if (typeof(l) != "undefined") {
                    m.setAttribute("title", l);
                }
                var e = "";
                if (typeof(a) == "undefined" || !a) {
                    e = "stroke:red; stroke-width:3; fill-opacity:0;";
                    m.setAttribute("style", e);
                } else {
                    if (a.stroke) {
                        e += "stroke:" + a.strokeColor + "; stroke-width:" + a.lineWidth + ";fill-opacity:0;";
                    }
                    if (a.opacity) {
                        e += "stroke-opacity:" + a.opacity + ";";
                    }
                    m.setAttribute("style", e);
                }
            }
        } else {
            var m = document.createElementNS("http://www.w3.org/2000/svg", "polyline");
            m.setAttribute("id", b);
            this._SVGDoc.appendChild(m);
            var k = "";
            for (var d = 0; d < h.parts[0].length; d++) {
                var n = this._map.mapToScreen(new SuperMap.Web.Core.Point2D(h.parts[0][d].x, h.parts[0][d].y));
                k += n.x + "," + n.y + " ";
            }
            m.setAttribute("points", k);
            if (typeof(l) != "undefined") {
                m.setAttribute("title", l);
            }
            var e = "";
            if (typeof(a) == "undefined" || !a) {
                e = "stroke:red; stroke-width:3; fill-opacity:0;";
                m.setAttribute("style", e);
            } else {
                if (a.stroke) {
                    e += "stroke:" + a.strokeColor + "; stroke-width:" + a.lineWidth + ";fill-opacity:0;";
                }
                if (a.opacity) {
                    e += "stroke-opacity:" + a.opacity + ";";
                }
                m.setAttribute("style", e);
            }
        }
    },
    drawPolygon: function(b, f, a, g) {
        if (typeof(f) == "undefined") {
            alert("geometry is null");
            return;
        }
        if (f && f.parts[0]) {
            var k = document.createElementNS("http://www.w3.org/2000/svg", "path");
            k.setAttribute("id", b);
            this._SVGDoc.appendChild(k);
            var h = "";
            for (var d = 0; d < f.parts.length; d++) {
                var l = f.parts[d];
                if (l && l.length > 0) {
                    var m = new Array();
                    for (var e = 0; e < l.length; e++) {
                        m.push(this._map.mapToScreen(l[e]));
                    }
                    h += "M" + m[0].x + "," + m[0].y + " L";
                    for (var e = 1; e < m.length; e++) {
                        h = h + m[e].x + "," + m[e].y + " ";
                    }
                    if (f.parts.length > 1) {
                        if ((m[0].x != m[m.length - 1].x) || (m[0].y != m[m.length - 1].y)) {
                            h = h + m[0].x + "," + m[0].y + " ";
                        }
                    }
                }
            }
            h = h + "Z";
            k.setAttribute("d", h);
            if (typeof(g) != "undefined") {
                k.setAttribute("title", g);
            }
            var c = "";
            if (typeof(a) == "undefined" || !a) {
                c = "stroke:red; stroke-width:3; fill:green; opacity:0.5";
                k.setAttribute("style", c);
            } else {
                if (a.stroke) {
                    c += "stroke:" + a.strokeColor + "; stroke-width:" + a.lineWidth + ";";
                }
                if (a.fill) {
                    c += "fill:" + a.fillColor + ";";
                } else {
                    c += "fill:transparent;";
                }
                c += "opacity:" + a.opacity + ";";
                k.setAttribute("style", c);
            }
        }
    },
    _updateFeature: function(a) {
        var b = a.id;
        this.clearFeature(b);
        this.addFeature(a);
    },
    _pxToNum: function(c) {
        var b = c;
        var a = Number(b.substring(0, (b.length - 2)));
        return a;
    }
};
SuperMap.Web.Mapping.SVGLayer.registerClass("SuperMap.Web.Mapping.SVGLayer", SuperMap.Web.Mapping.FeaturesLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.VMLLayer = function() {
    SuperMap.Web.Mapping.VMLLayer.initializeBase(this);
    this._isInitVML = false;
    this._type = "VMLLayer";
    this._vmlGroup = null;
    this._clickEventDelegate = Function.createDelegate(this, this._clickEvent);
    this._clickEventHandler = null;
    this._featuresSum = 0;
};
SuperMap.Web.Mapping.VMLLayer.prototype = {
    set_container: function(container) {
        var e = Function._validateParams(arguments, [{ name: "container", domElement: true }]);
        if (e) {
            return false;
        }
        this._container = container;
        this._width = (container.style.width + "").replace("px", "");
        this._width = this._width.replace("pt", "");
        this._width = eval(this._width);
        this._height = (container.style.height + "").replace("px", "");
        this._height = this._height.replace("pt", "");
        this._height = eval(this._height);
        var strGroup = "<v:group id='vmlGroup' style='position:absolute;left: 0; top: 0; width: " + this._width + "px; height: " + this._height + "px;' coordsize='" + this._width + "," + this._height + "'></v:group>";
        this._vmlGroup = document.createElement(strGroup);
        this._container.appendChild(this._vmlGroup);
    },
    initialize: function() {
        var b = document.getElementsByTagName("!");
        if (b.length > 0) {
            var d = b[0];
            var a = d.nodeValue;
            var c = a.search( /XHTML 1.0/i );
            if (c != -1) {
                this._isInitVML = true;
            }
        }
        if (this._isInitVML != true) {
            if (!window.vml) {
                window.vml = { };
                if (!document.namespaces.vml && !+"\v1") {
                    document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
                }
                document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML); position: absolute; display:inline-block;");
            }
        }
        this._initialized = true;
        this.raise_initialized(this);
    },
    modifyFeature: function(b, g, a, j) {
        for (var d = 0; d < this._features.length; d++) {
            if (this._features[d].id == b) {
                var k = this._features[d];
            }
        }
        if (!k) {
            return;
        }
        if (g) {
            k.geometry = g;
        } else {
        }
        if (a) {
            k.style = a;
        }
        var c = null;
        if (b) {
            c = document.getElementById(b);
        }
        if (j && typeof(j) == "string") {
            k.attributes.title = j;
            c.setAttribute("title", j);
        }
        if (SuperMap.Web.Core.GeoPoint.isInstanceOfType(k.geometry)) {
            var f = k.style.pointRadius;
            if (a && a.pointRadius) {
                f = a.pointRadius;
            }
            this._modifyCircle(new SuperMap.Web.Core.Point2D(k.geometry.x, k.geometry.y), c, a, f, f);
            return k;
        }
        if (SuperMap.Web.Core.GeoLine.isInstanceOfType(k.geometry)) {
            this._modifyLine(g, c, a, false);
            return k;
        }
        if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(k.geometry)) {
            this._modifyLine(g, c, a, true);
            return k;
        }
        if (SuperMap.Web.Core.GeoCircle.isInstanceOfType(k.geometry)) {
            var f = g.geoRadius / this._map._resolution;
            this._modifyCircle(g.center, c, a, f, f);
            return k;
        }
        if (SuperMap.Web.Core.GeoEllipse.isInstanceOfType(k.geometry)) {
            var h = g.xGeoRadius / this._map._resolution;
            var e = g.yGeoRadius / this._map._resolution;
            this._modifyCircle(g.center, c, a, h, e);
            return k;
        }
    },
    clear: function() {
        if (this._vmlGroup.hasChildNodes()) {
            while (this._vmlGroup.childNodes.length > 0) {
                this._vmlGroup.removeChild(this._vmlGroup.childNodes[0]);
            }
        }
    },
    clearFeatures: function(b) {
        if (b instanceof Array) {
            for (var a = b.length - 1; a >= 0; a--) {
                this.clearFeature(b[a].id);
            }
        } else {
            while (this._features.length > 0) {
                this._features.pop();
            }
            this._featuresSum = 0;
            this.clear();
        }
    },
    clearFeature: function(b) {
        if (b) {
            for (var a = 0; a < this._features.length; a++) {
                if (this._features[a].id == b) {
                    this._features.splice(a, 1);
                    this._featuresSum--;
                    this._vmlGroup.removeChild(document.getElementById(b));
                    return;
                }
            }
        }
    },
    drawPoint: function(d, a, b, c) {
        if (!this._viewBounds.contains(a.x, a.y)) {
            return;
        }
        this._drawCircle(a, b, b.pointRadius, b.pointRadius, d, c);
    },
    drawCircle: function(e, b, c, d) {
        if (!this._viewBounds.contains(b.center.x, b.center.y)) {
            return;
        }
        var a = b.geoRadius / this._map._resolution;
        this._drawCircle(b.center, c, a, a, e, d);
    },
    drawEllipse: function(f, d, b, c) {
        if (!this._viewBounds.contains(d.center.x, d.center.y)) {
            return;
        }
        var e = d.xGeoRadius / this._map._resolution;
        var a = d.yGeoRadius / this._map._resolution;
        this._drawCircle(d.center, b, e, a, f, c);
    },
    drawLine: function(d, c, a, b) {
        if (c) {
            this._drawLine(c, a, d, b, false);
        } else {
            this._drawLine(null, a, d, b, false);
        }
    },
    drawPolygon: function(d, c, a, b) {
        if (c) {
            this._drawLine(c, a, d, b, true);
        } else {
            this._drawLine(null, a, d, b, true);
        }
    },
    _drawCircle: function(h, b, g, e, c, f) {
        if (h && (g || g == 0 || e || e == 0)) {
            var j = new SuperMap.Web.Core.Point2D(h.x, h.y);
            j = this._map.mapToScreen(j);
            if (!j) {
                return;
            }
            if (this._isInitVML == false) {
                var a = this._createNode("v:oval", c, f);
            } else {
                var a = this._createNode("v:arc", c, f);
                a.startangle = "360";
                a.endangle = "0";
            }
            a.style.position = "absolute";
            a.style.top = j.y - e;
            a.style.left = j.x - g;
            a.style.width = g * 2;
            a.style.height = e * 2;
            this._vmlGroup.appendChild(a);
        }
        if (b) {
            if (this._isInitVML == false) {
                if (b.fill) {
                    a.setAttribute("filled", "true");
                    if (b.fillColor) {
                        a.setAttribute("fillcolor", b.fillColor);
                    }
                    var i = document.createElement("v:fill");
                    a.appendChild(i);
                } else {
                    a.setAttribute("filled", "false");
                }
                if (b.stroke) {
                    a.setAttribute("stroked", "true");
                    if (b.strokeColor) {
                        a.setAttribute("strokecolor", b.strokeColor);
                    }
                    if (b.lineWidth) {
                        a.setAttribute("strokeweight", b.lineWidth);
                    }
                    var d = this._createNode("v:stroke");
                    a.appendChild(d);
                } else {
                    a.setAttribute("stroked", "false");
                }
                if (b.opacity) {
                    if (i) {
                        i.opacity = b.opacity;
                    }
                    if (d) {
                        d.opacity = b.opacity;
                    }
                }
            } else {
                if (b.fill) {
                    a.filled = "true";
                    if (b.fillColor) {
                        a.fillcolor = b.fillColor;
                    }
                } else {
                    a.filled = "false";
                }
                if (b.stroke) {
                    a.stroked = "true";
                    if (b.strokeColor) {
                        a.strokecolor = b.strokeColor;
                    }
                    if (b.lineWidth) {
                        a.strokeweight = b.lineWidth;
                    }
                } else {
                    a.stroked = "false";
                }
                if (b.opacity != 1) {
                    a.style.filter = "alpha(opacity=" + (b.opacity * 100) + ")";
                }
            }
        }
    },
    _modifyCircle: function(h, g, c, d, a) {
        if (h) {
            var f = this._map.mapToScreen(h);
            g.style.left = f.x - d;
            g.style.top = f.y - a;
        }
        if (d || d == 0 || a || a == 0) {
            g.style.width = d * 2;
            g.style.height = a * 2;
        }
        if (c) {
            if (this._isInitVML == false) {
                if (c.fill) {
                    g.setAttribute("filled", "true");
                    if (c.fillColor) {
                        g.setAttribute("fillcolor", c.fillColor);
                    }
                    var e = document.createElement("v:fill");
                    g.appendChild(e);
                } else {
                    g.setAttribute("fillcolor", "false");
                }
                if (c.stroke) {
                    g.setAttribute("stroked", "true");
                    if (c.strokeColor) {
                        g.setAttribute("strokecolor", c.strokeColor);
                    }
                    var b = this._createNode("v:stroke");
                    g.appendChild(b);
                } else {
                    g.setAttribute("stroked", "false");
                }
                if (c.opacity) {
                    if (e) {
                        e.opacity = c.opacity;
                    }
                    if (b) {
                        b.opacity = c.opacity;
                    }
                }
            } else {
                if (c.fill) {
                    g.filled = "true";
                    if (c.fillColor) {
                        g.fillcolor = c.fillColor;
                    }
                } else {
                    g.filled = "false";
                }
                if (c.stroke) {
                    g.stroked = "true";
                    if (c.strokeColor) {
                        g.strokecolor = c.strokeColor;
                    }
                } else {
                    g.stroked = "false";
                }
                if (c.opacity != 1) {
                    g.style.filter = "alpha(opacity=" + (c.opacity * 100) + ")";
                }
            }
        }
    },
    _drawLine: function(h, a, b, l, e) {
        var c = this._createNode("v:shape", b, l);
        this._vmlGroup.appendChild(c);
        if (h && h.parts[0]) {
            var m = "";
            for (var f = 0; f < h.parts.length; f++) {
                var k = h.parts[f];
                if (k && k.length > 0) {
                    var o = new Array();
                    for (var g = 0; g < k.length; g++) {
                        o.push(this._map.mapToScreen(k[g]));
                    }
                    m += "m " + o[0].x + "," + o[0].y + " l ";
                    for (var g = 1; g < o.length; g++) {
                        m = m + o[g].x + "," + o[g].y + " ";
                    }
                    if (e == true) {
                        if (h.parts.length > 1) {
                            if ((o[0].x != o[o.length - 1].x) || (o[0].y != o[o.length - 1].y)) {
                                m = m + o[0].x + "," + o[0].y + " ";
                            }
                        }
                    }
                }
            }
            if (e == true) {
                m = m + "x e";
            } else {
                m = m + "e";
            }
        }
        c.style.position = "absolute";
        c.style.left = 0;
        c.style.top = 0;
        c.style.width = 100;
        c.style.height = 100;
        c.coordsize = "100, 100";
        c.path = m;
        if (a) {
            if (this._isInitVML == false) {
                c.filled = a.fill;
                c.stroked = a.stroke;
                if (a.stroke) {
                    c.setAttribute("strokecolor", a.strokeColor);
                    c.setAttribute("strokeweight", a.lineWidth);
                    if (!d) {
                        var d = this._createNode("v:stroke");
                        c.appendChild(d);
                        if (a.lineCap.StartArrow) {
                            d.setAttribute("StartArrow", a.lineCap.StartArrow);
                        }
                        if (a.lineCap.EndArrow) {
                            d.setAttribute("EndArrow", a.lineCap.EndArrow);
                        }
                        if (a.dashStyle) {
                            d.setAttribute("dashstyle", a.dashStyle);
                        }
                    }
                }
                if (a.fill) {
                    c.setAttribute("fillcolor", a.fillColor);
                }
                if (a.opacity) {
                    var n = document.createElement("v:fill");
                    c.appendChild(n);
                    n.opacity = a.opacity;
                    if (d) {
                        d.opacity = a.opacity;
                    }
                }
            } else {
                c.filled = a.fill;
                if (a.opacity != 1) {
                    c.style.filter = "alpha(opacity=" + (a.opacity * 100) + ")";
                }
                if (a.stroke) {
                    c.stroked = a.stroke;
                    c.strokecolor = a.strokeColor;
                    c.strokeweight = a.lineWidth;
                    if (!d) {
                        var d = this._createNode("v:stroke");
                        c.appendChild(d);
                        if (a.lineCap.StartArrow) {
                            d.startArrow = a.lineCap.StartArrow;
                        }
                        if (a.lineCap.EndArrow) {
                            d.endArrow = a.lineCap.EndArrow;
                        }
                        if (a.dashStyle) {
                            d.dashstyle = a.dashStyle;
                        }
                    }
                }
                if (a.fill) {
                    c.fillcolor = a.fillColor;
                    if (a.opacity) {
                        var n = document.createElement("v:fill");
                        c.appendChild(n);
                        n.opacity = a.opacity;
                    }
                }
            }
        }
    },
    _modifyLine: function(f, b, a, k) {
        if (f && f.parts[0]) {
            var g = "";
            for (var d = 0; d < f.parts.length; d++) {
                var h = f.parts[d];
                if (h && h.length > 0) {
                    var m = new Array();
                    for (var e = 0; e < h.length; e++) {
                        m.push(this._map.mapToScreen(h[e]));
                    }
                    g += "m " + (m[0].x - this._pxToNum(b.style.left)) + "," + (m[0].y - this._pxToNum(b.style.top)) + " l ";
                    for (var e = 1; e < m.length; e++) {
                        g = g + (m[e].x - this._pxToNum(b.style.left)) + "," + (m[e].y - this._pxToNum(b.style.top)) + " ";
                    }
                }
                if (k == true) {
                    g = g + "x e";
                    b.path = g;
                } else {
                    g = g + "e";
                    b.path = g;
                }
            }
        }
        if (a) {
            if (this._isInitVML == false) {
                b.filled = a.fill;
                b.stroked = a.stroke;
                if (a.stroke) {
                    b.setAttribute("strokecolor", a.strokeColor);
                    b.setAttribute("strokeweight", a.lineWidth);
                    if (!c) {
                        var c = this._createNode("v:stroke");
                        b.appendChild(c);
                        if (a.lineCap.StartArrow) {
                            c.setAttribute("StartArrow", a.lineCap.StartArrow);
                        }
                        if (a.lineCap.EndArrow) {
                            c.setAttribute("EndArrow", a.lineCap.EndArrow);
                        }
                        if (a.dashStyle) {
                            c.setAttribute("dashstyle", a.dashStyle);
                        }
                    }
                }
                if (a.fill) {
                    b.setAttribute("fillcolor", a.fillColor);
                }
                if (a.opacity) {
                    var l = document.createElement("v:fill");
                    b.appendChild(l);
                    l.opacity = a.opacity;
                    if (c) {
                        c.opacity = a.opacity;
                    }
                }
            } else {
                b.filled = a.fill;
                if (a.opacity != 1) {
                    b.style.filter = "alpha(opacity=" + (a.opacity * 100) + ")";
                }
                if (a.stroke) {
                    b.stroked = a.stroke;
                    b.strokecolor = a.strokeColor;
                    b.strokeweight = a.lineWidth;
                    if (!c) {
                        var c = this._createNode("v:stroke");
                        b.appendChild(c);
                        if (a.lineCap.StartArrow) {
                            c.startArrow = a.lineCap.StartArrow;
                        }
                        if (a.lineCap.EndArrow) {
                            c.endArrow = a.lineCap.EndArrow;
                        }
                        if (a.dashStyle) {
                            c.dashstyle = a.dashStyle;
                        }
                    }
                }
                if (a.fill) {
                    b.fillcolor = a.fillColor;
                    if (a.opacity) {
                        var l = document.createElement("v:fill");
                        b.appendChild(l);
                        l.opacity = a.opacity;
                    }
                }
            }
        }
    },
    _createNode: function(a, d, c) {
        var b = document.createElement(a);
        if (d) {
            b.setAttribute("id", d);
        }
        if (c && typeof(c) == "string") {
            b.setAttribute("title", c);
        }
        b.unselectable = "on";
        b.onselectstart = function() { return (false); };
        return b;
    },
    _clickEvent: function(b) {
        if (this._clickEventHandler) {
            var a = this._findFeature(b.target.id);
            this._clickEventHandler(a);
        }
    },
    _findFeature: function(b) {
        for (var a = 0; a < this._features.length; a++) {
            if (this._features[a].id == b) {
                return this._features[a];
            }
        }
        return null;
    },
    _pxToNum: function(c) {
        var b = c;
        var a = Number(b.substring(0, (b.length - 2)));
        return a;
    }
};
SuperMap.Web.Mapping.VMLLayer.registerClass("SuperMap.Web.Mapping.VMLLayer", SuperMap.Web.Mapping.FeaturesLayer);
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.Resources = function() {
};
SuperMap.Web.Mapping.Resources.zh_cn = { CanvasLayer_initialize_NoSupported: "当前浏览器不支持Canvas。", CanvasLayer_drawFeature_IdRepeat: "所添加的对象的ID已经存在。", DynamicImageLayer_createDynamicImage_NoContainer: "没有装载地图的容器。", DynamicImageLayer_createDynamicImage_ImagePathError: "图片路径错误。", DynamicWMSLayer_getImageUrl_VariableIllegal: "获取图片地址的必要参数不全。", DynamicWMSLayer_getImageUrl_ViewBoundsEmpty: "当前ViewBounds为空", Layer_setMaxVisibleScale_maxScaleOutside: "输入值非法，最大的scale不应该小于最小的scale", Layer_setMaxVisibleScale_negativeMaxScale: "输入值非法，最大scale不应该为负数", Layer_setMinVisibleScale_MinScaleOutside: "输入值非法，最小scale不应该大于于最大scale", Layer_setMinVisibleScale_negativeMinScale: "输入值非法，最小scale不应该为负数", Layer_setScale__ScaleOutside: "输入值非法，scale不在最大和最小scale之间", Map_setLayers_parameterError: "输入值非法，参数Layers不是数组或其成员不是SuperMap.Web.Mapping.Layer类型", Map_setBounds_parameterError: "输入值非法，参数bounds应该是SuperMap.Web.Core.Rectangle2D类型", Map_setViewBounds_parameterError: "输入值非法，参数viewBounds应该是SuperMap.Web.Core.Rectangle2D类型", Map_setCenter_parameterError: "输入值非法，参数center应该是SuperMap.Web.Core.Point2D类型", Map_setScales_parameterError: "输入值非法，参数scales不是数组或其成员不是Number类型", Map_setScales_parameterIsNaN: "输入值非法，参数scales的成员不应该是NaN类型", Map_setScales_DpiIsNull: "Dpi为空", Map_setResolutions_parameterError: "输入值非法，参数resolutions不是数组或其成员不是Number类型", Map_setResolutions_parameterIsNaN: "输入值非法，参数resolutions的成员不应该是NaN类型", Map_setMaxScale_parameterError: "输入值非法，参数maxscale应该是Number类型", Map_setMaxScale_maxScaleOutside: "输入值非法，最大的scale不应该小于最小的scale", Map_setMaxScale_negativeMaxScale: "输入值非法，最大scale不应该为负数", Map_setMinScale_parameterError: "输入值非法，参数minscale应该是Number类型", Map_setMinScale_MinScaleOutside: "输入值非法，最小scale不应该大于于最大scale", Map_setMinScale_negativeMinScale: "输入值非法，最小scale不应该为负数", Map_setScale_parameterError: "输入值非法，参数scale不是Number类型或参数scale是NaN类型", Map_setScale_negativeScale: "输入值非法，scale不应该为负数", Map_setAngle_parameterError: "输入值非法，参数angle应该是Number类型", Map_setAngle_AngleOutside: "输入值非法，参数angle超出范围", Map_setResolution_parameterError: "输入值非法，参数resolution不是Number类型或参数resolution是NaN类型", Map_setResolution_negativeResolution: "输入值非法，Resolution不应该为负数", Map_setIsDynamicPrejection_parameterError: "输入值非法，参数isDynamicPrejection应该为boolean类型", Map_setClipRegion_parameterError: "输入值非法，参数clipRegion应该为SuperMap.Web.Core.Geometry类型", Map_setReferParam_parameterError: "输入值非法，参数mapParam应该为SuperMap.Web.Mapping.MapParam类型", Map_setViewSize_parameterError: "输入值非法，参数viewSize应该为SuperMap.Web.Core.Rectangle类型", Map_addLayer_parameterError: "输入值非法，参数layer应该为SuperMap.Web.Mapping.Layer类型", Map_removeLayerByIndex_parameterError: "输入值非法，参数index应该为Number类型", Map_pan_parameterError: "输入值非法，参数offsetX和offsetY应该为Number类型", Map_zoom_parameterError: "输入值非法，参数ratio应该为Number类型", Map_zoom_negativeRatio: "输入值非法，ratio不应该为负数且ratio不应该为NaN", Map_zoomToLevel_levelError: "输入值非法，参数level应该为Number类型", Map_zoomToLevel_resolutionsNull: "当前resolutions数组的长度为0.", Map_viewEntire_conditionLack: "所需条件不足，不能全幅显示", Map_viewEntire_viewSizeEmpty: "全幅时viewwer为空", Map_mapToScreen_parameterError: "输入值非法，参数point2D应该为SuperMap.Web.Core.Point2D类型", Map_screenToMap_parameterError: "输入值非法，参数point应该为SuperMap.Web.Core.Point2D类型", Map_draw_LayersNull: "当前Map上没有layers", Map_computeResolutionByDpi_dpiScaleNull: "当前Dpi或者Scale为空", Map_computeResolutionByDpi_scaleNull: "当前Scale为空", Map_checkBounds_boundsNull: "当前Layer的Bounds为空", Map_computeResolutionByBounds_viewBoundsViewSizeNull: "当前ViewBounds或ViewSize为空", Map_computeViewBoundsByResolution_centerViewSizeNull: "当前Center或ViewSize为空", Map_computeScaleByResolution_dpiNull: "当前Dpi为空", TiledCachedIServerLayer_setScales_parameterError: "输入值非法，参数scales应该为Array类型", TiledCachedIServerLayer_initialize_logMapStatus: "TiledCachedIServerLayer地图状况日志", TiledCachedIServerLayer_initialize_logMapName: "地图名是:", TiledCachedIServerLayer_initialize_logMapUrl: "地图服务访问地址是:", TiledCachedIServerLayer_initialize_logMapServicesAddress: "GIS服务地址是:", TiledCachedIServerLayer_initialize_logMapServicesPort: "GIS服务器端口是:", TiledCachedIServerLayer_onInitError_initializeFailed: "初始化地图失败", TiledCachedLayer_draw_containNull: "当前layer的容器不存在", TiledCachedLayer_initializeLoadTile_resolutionsNull: "当前resolutions数组的长度为0", TiledDynamicIServerLayer_initialize_logMapStatus: "TiledDynamicIServerLayer地图状况日志", TiledDynamicIServerLayer_initialize_logMapName: "地图名是:", TiledDynamicIServerLayer_initialize_logMapUrl: "地图服务访问地址是:", TiledDynamicIServerLayer_initialize_logMapServicesAddress: "GIS服务地址是:", TiledDynamicIServerLayer_initialize_logMapServicesPort: "GIS服务器端口是:", TiledDynamicIServerLayer_onInitError_initializeFailed: "初始化地图失败", TiledDynamicLayer_draw_containNull: "当前layer的容器不存在" };
SuperMap.Web.Mapping.Resources.registerClass("SuperMap.Web.Mapping.Resources");
Type.registerNamespace("SuperMap.Web.Mapping");
SuperMap.Web.Mapping.Logo = function(a) {
    a = this._extend(a);
    this._map = null;
    this._imageSrc = a.imageSrc;
    this._pos = a.pos;
    this._linkUrl = a.linkUrl;
    this._showing = true;
};
SuperMap.Web.Mapping.Logo.prototype = {
    get_map: function() { return this._map; },
    setLinkUrl: function(a) {
        this._linkUrl = a;
        this._link.href = a;
    },
    setImgLocation: function(a) {
        this._imageSrc = a;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            if (Sys.Browser.version == 6) {
                this._element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src='" + a + "');";
            } else {
                this._element.style.backgroundImage = "url(" + a + ")";
            }
        } else {
            this._element.style.backgroundImage = "url(" + a + ")";
        }
    },
    setPosition: function(a) {
        this._pos = a;
        this._element.style.left = a.x + "px";
        this._element.style.top = a.y + "px";
    },
    show: function() {
        this._element.style.display = "block";
        this._showing = true;
    },
    hide: function() {
        this._element.style.display = "none";
        this._showing = false;
    },
    _extend: function(a) {
        if (!a) {
            a = { };
        }
        if (!a.imageSrc) {
            a.imageSrc = "images/logo/supermap_logo.png";
        }
        if (!a.pos) {
            a.pos = new SuperMap.Web.Core.Point(5, 5);
        }
        if (!a.linkUrl) {
            a.linkUrl = "http://www.supermap.com.cn/";
        }
        return a;
    },
    initialize: function(a) {
        this._map = a;
        this._createTemplete();
        this._putOn(this._map._workLayer);
    },
    _createTemplete: function() {
        this._element = document.createElement("div");
        this._element.id = "Logo";
        this._element.style.position = "absolute";
        this._element.style.right = this._pos.x + "px";
        this._element.style.bottom = this._pos.y + "px";
        this._element.style.height = "35px";
        this._element.style.width = "116px";
        this._element.style.cursor = "pointer";
        this._element.style.display = "block";
        this._element.style.zIndex = 100;
        this._link = document.createElement("a");
        this._link.href = this._linkUrl;
        this._link.target = "_blank";
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            if (Sys.Browser.version == 6) {
                this._element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src='" + this._imageSrc + "');";
            } else {
                this._element.style.backgroundImage = "url(" + this._imageSrc + ")";
            }
        } else {
            this._element.style.backgroundImage = "url(" + this._imageSrc + ")";
        }
        this._link.appendChild(this._element);
        this._element.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._element.onmouseup = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._element.onmousemove = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._element.onclick = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._element.ondblclick = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._element.onmousewheel = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        if (document.addEventListener) {
            this._mouseScrollDelegate = Function.createDelegate(this, this._mouseScroll);
            this._element.addEventListener("DOMMouseScroll", this._mouseScrollDelegate, true);
        }
        this._element.oncontextmenu = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._element.onkeydown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._element.onkeyup = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
    },
    _mouseScroll: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
    },
    _putOn: function(a) { a.appendChild(this._link); }
};
SuperMap.Web.Mapping.Logo.registerClass("SuperMap.Web.Mapping.Logo", Sys.UI.Control, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Actions");
SuperMap.Web.Actions.MapAction = function() {
    SuperMap.Web.Actions.MapAction.initializeBase(this);
    this._type = "MapAction";
    this._map = null;
};
SuperMap.Web.Actions.MapAction.prototype = {
    get_map: function() { return this._map; },
    set_map: function(a) { this._map = a; },
    get_type: function() { return this._type; },
    dispose: function() { this._map = null; },
    initialize: function() {
    },
    onClick: function(a) {
    },
    onDblClick: function(d) {
        var c = 2;
        var b = this._map.get_resolution() / c;
        var a = this._map._getCenterByMousePosition(b, d);
        this._map._zoomToResolution(b, a);
    },
    onMouseMove: function(a) {
    },
    onMouseDown: function(a) {
    },
    onMouseUp: function(a) {
    },
    onMouseWheel: function(a) {
    },
    onKeyDown: function(a) {
    },
    onKeyUp: function(a) {
    },
    add_actionCompleted: function(a) { this._addEvent("actionCompleted", a); },
    remove_actionCompleted: function(a) { this._removeEvent("actionCompleted", a); },
    raise_actionCompleted: function(a, b) { this._raiseEvent("actionCompleted", a, b); },
    _addEvent: function(a, b) { this.get_events().addHandler(a, b); },
    _removeEvent: function(a, b) { this.get_events().removeHandler(a, b); },
    _raiseEvent: function(a, c, d) {
        var b = this.get_events().getHandler(a);
        if (b) {
            b(c, d);
        }
    }
};
SuperMap.Web.Actions.MapAction.registerClass("SuperMap.Web.Actions.MapAction", Sys.Component, Sys.IDisposable);
SuperMap.Web.Actions.Pan = function() {
    SuperMap.Web.Actions.Pan.initializeBase(this);
    this._type = "PanAction";
    this._actionStarted = false;
};
SuperMap.Web.Actions.Pan.prototype = {
    dispose: function() {
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() { this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/Pan.cur),auto"; },
    onMouseMove: function(c) {
        if (!this._actionStarted) {
            return;
        }
        this._actionFlage = true;
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/PanDown.cur),auto";
        var b = SuperMap.Web.Utility.getMouseX(c);
        var a = SuperMap.Web.Utility.getMouseY(c);
        this._map.panByPixel((this._oldMouseX - b), (this._oldMouseY - a));
        this._oldMouseX = b;
        this._oldMouseY = a;
    },
    onMouseDown: function(a) {
        if (a.button != 0) {
            return;
        }
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/PanDown.cur),auto";
        this._actionStarted = true;
        this._actionFlage = false;
        this._map._panActionMark = true;
        this._oldMouseX = SuperMap.Web.Utility.getMouseX(a);
        this._oldMouseY = SuperMap.Web.Utility.getMouseY(a);
        if (this._map.get_element().setCapture) {
            this._map.get_element().setCapture();
        }
    },
    onMouseUp: function(b) {
        if (b.button != 0) {
            return;
        }
        this._actionStarted = false;
        this._map._panActionMark = false;
        if (this._actionFlage) {
            this._map.panByPixel(0, 0);
        }
        if (this._map.get_element().releaseCapture) {
            this._map.get_element().releaseCapture();
        }
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/Pan.cur),auto";
        var a = { actionName: "PanAction" };
        this.raise_actionCompleted(a);
    }
};
SuperMap.Web.Actions.Pan.registerClass("SuperMap.Web.Actions.Pan", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.ZoomIn = function() {
    SuperMap.Web.Actions.ZoomIn.initializeBase(this);
    this._type = "ZoomInAction";
    this._mapDiv = null;
    this._zoomRect = null;
    this._originX = 0;
    this._originY = 0;
    this.actionStarted = false;
    this._oldClientX = 0;
    this._oldClientY = 0;
};
SuperMap.Web.Actions.ZoomIn.prototype = {
    dispose: function() {
        if (this._map && this._map.get_element()) {
            this._zoomInRect = $get(this._map.get_id() + "_zoomInRect");
            if (this._zoomInRect) {
                this._mapDiv.removeChild(this._zoomInRect);
            }
            this._mapDiv = null;
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/ZoomIn.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._zoomInRect = $get(this._map.get_id() + "_zoomInRect");
        if (!this._zoomInRect) {
            this._zoomInRect = document.createElement("div");
            this._zoomInRect.id = this._map.get_id() + "_zoomInRect";
            this._zoomInRect.style.position = "absolute";
            this._zoomInRect.style.fontSize = 0;
            this._zoomInRect.style.height = "1px";
            this._zoomInRect.style.display = "block";
            this._zoomInRect.style.border = "2px dashed #336699";
            this._zoomInRect.style.zIndex = 100;
            this._hide();
            this._mapDiv.appendChild(this._zoomInRect);
        }
    },
    onClick: function(f) {
        if (f.button != 0) {
            return;
        }
        if (this._oldClientX == SuperMap.Web.Utility.getMouseX(f) && this._oldClientY == SuperMap.Web.Utility.getMouseY(f)) {
            this.actionStarted = false;
            var a = new SuperMap.Web.Core.Point();
            this._originX = SuperMap.Web.Utility.getMouseX(f) - this._containerX;
            this._originY = SuperMap.Web.Utility.getMouseY(f) - this._containerY;
            a.x = this._originX;
            a.y = this._originY;
            var c = this._map.screenToMap(a);
            var d = this._map.get_resolution();
            var b = d / 2;
            this._map._zoomToResolution(b, c);
        }
    },
    onDblClick: function(a) {
        if (a.button != 0) {
            return;
        }
    },
    onMouseDown: function(a) {
        if (a.button != 0) {
            return;
        }
        this.actionStarted = true;
        this._actionFlage = false;
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
        this._originX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._originY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._oldClientX = SuperMap.Web.Utility.getMouseX(a);
        this._oldClientY = SuperMap.Web.Utility.getMouseY(a);
    },
    onMouseMove: function(a) {
        if (!this.actionStarted) {
            return;
        }
        this._actionFlage = true;
        this._x = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._y = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._width = Math.abs(this._x - this._originX);
        this._height = Math.abs(this._y - this._originY);
        this._draw(Math.min(this._originX, this._x), Math.min(this._originY, this._y), Math.max(1, this._width), Math.max(1, this._height));
        this._show();
    },
    onMouseUp: function(c) {
        if (c.button != 0) {
            return;
        }
        if (this._oldClientX != SuperMap.Web.Utility.getMouseX(c) && this._oldClientY != SuperMap.Web.Utility.getMouseY(c)) {
            this.actionStarted = false;
            if (this._actionFlage) {
                var g = this._map.get_resolution();
                var h = this._map.get_width() / this._width;
                var f = this._map.get_height() / this._height;
                var d = h < f ? h : f;
                var b = g / d;
                var a = new SuperMap.Web.Core.Point();
                if (this._originX < this._x) {
                    a.x = this._originX + this._width / 2;
                } else {
                    a.x = this._x + this._width / 2;
                }
                if (this._originY < this._y) {
                    a.y = this._originY + this._height / 2;
                } else {
                    a.y = this._y + this._height / 2;
                }
                var i = this._map.screenToMap(a);
                this._map._zoomToResolution(b, i);
            }
            this._hide();
            var j = { actionName: "ZoomInAction" };
            this.raise_actionCompleted(j);
        }
    },
    _draw: function(b, d, c, a) { this._setPosAndSize(this._zoomInRect, b, d, c, a); },
    _setPosAndSize: function(d, b, e, c, a) {
        d.style.left = b + "px";
        d.style.top = e + "px";
        d.style.width = c + "px";
        d.style.height = a + "px";
    },
    _show: function() { this._zoomInRect.style.display = "block"; },
    _hide: function() { this._zoomInRect.style.display = "none"; }
};
SuperMap.Web.Actions.ZoomIn.registerClass("SuperMap.Web.Actions.ZoomIn", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.ZoomOut = function() {
    SuperMap.Web.Actions.ZoomOut.initializeBase(this);
    this._type = "ZoomOutAction";
    this._mapDiv = null;
    this._zoomRect = null;
    this._originX = 0;
    this._originY = 0;
    this.actionStarted = false;
    this._oldClientX = 0;
    this._oldClientY = 0;
};
SuperMap.Web.Actions.ZoomOut.prototype = {
    dispose: function() {
        if (this._map && this._map.get_element()) {
            this._zoomOutRect = $get(this._map.get_id() + "_zoomOutRect");
            if (this._zoomOutRect) {
                this._mapDiv.removeChild(this._zoomOutRect);
                this._zoomOutRect = null;
            }
            this._mapDiv = null;
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/ZoomOut.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._zoomOutRect = $get(this._map.get_id() + "_zoomOutRect");
        if (!this._zoomOutRect) {
            this._zoomOutRect = document.createElement("div");
            this._zoomOutRect.id = this._map.get_id() + "_zoomOutRect";
            this._zoomOutRect.style.position = "absolute";
            this._zoomOutRect.style.fontSize = 0;
            this._zoomOutRect.style.height = "1px";
            this._zoomOutRect.style.display = "block";
            this._zoomOutRect.style.border = "2px dashed #336699";
            this._zoomOutRect.style.zIndex = 100;
            this._hide();
            this._mapDiv.appendChild(this._zoomOutRect);
        }
    },
    onClick: function(f) {
        if (f.button != 0) {
            return;
        }
        if (this._oldClientX == SuperMap.Web.Utility.getMouseX(f) && this._oldClientY == SuperMap.Web.Utility.getMouseY(f)) {
            this.actionStarted = false;
            var a = new SuperMap.Web.Core.Point();
            this._originX = SuperMap.Web.Utility.getMouseX(f) - this._containerX;
            this._originY = SuperMap.Web.Utility.getMouseY(f) - this._containerY;
            a.x = this._originX;
            a.y = this._originY;
            var c = this._map.screenToMap(a);
            var d = this._map.get_resolution();
            var b = d * 2;
            this._map._zoomToResolution(b, c);
        }
    },
    onDblClick: function(a) {
        if (a.button != 0) {
            return;
        }
    },
    onMouseDown: function(a) {
        if (a.button != 0) {
            return;
        }
        this.actionStarted = true;
        this._actionFlage = false;
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
        this._originX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._originY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._oldClientX = SuperMap.Web.Utility.getMouseX(a);
        this._oldClientY = SuperMap.Web.Utility.getMouseY(a);
    },
    onMouseMove: function(a) {
        if (!this.actionStarted) {
            return;
        }
        this._actionFlage = true;
        this._x = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._y = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._width = Math.abs(this._x - this._originX);
        this._height = Math.abs(this._y - this._originY);
        this._draw(Math.min(this._originX, this._x), Math.min(this._originY, this._y), Math.max(1, this._width), Math.max(1, this._height));
        this._show();
    },
    onMouseUp: function(c) {
        if (c.button != 0) {
            return;
        }
        if (this._oldClientX != SuperMap.Web.Utility.getMouseX(c) && this._oldClientY != SuperMap.Web.Utility.getMouseY(c)) {
            this.actionStarted = false;
            if (this._actionFlage) {
                var g = this._map.get_resolution();
                var h = this._width / this._map.get_width();
                var f = this._height / this._map.get_height();
                var d = h > f ? h : f;
                var b = g / d;
                var a = new SuperMap.Web.Core.Point();
                if (this._originX < this._x) {
                    a.x = this._originX + this._width / 2;
                } else {
                    a.x = this._x + this._width / 2;
                }
                if (this._originY < this._y) {
                    a.y = this._originY + this._height / 2;
                } else {
                    a.y = this._y + this._height / 2;
                }
                var i = this._map.screenToMap(a);
                this._map._zoomToResolution(b, i);
            }
            this._hide();
            var j = { actionName: "ZoomOutAction" };
            this.raise_actionCompleted(j);
        }
    },
    _draw: function(b, d, c, a) { this._setPosAndSize(this._zoomOutRect, b, d, c, a); },
    _setPosAndSize: function(d, b, e, c, a) {
        d.style.left = b + "px";
        d.style.top = e + "px";
        d.style.width = c + "px";
        d.style.height = a + "px";
    },
    _show: function() { this._zoomOutRect.style.display = "block"; },
    _hide: function() { this._zoomOutRect.style.display = "none"; }
};
SuperMap.Web.Actions.ZoomOut.registerClass("SuperMap.Web.Actions.ZoomOut", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawPoint = function() {
    SuperMap.Web.Actions.DrawPoint.initializeBase(this);
    this._actionStarted = false;
    this._type = "DrawPointAction";
    this._mapDiv = null;
    this._containerX = null;
    this._containerY = null;
    this._point = new SuperMap.Web.Core.GeoPoint();
};
SuperMap.Web.Actions.DrawPoint.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/PointQuery.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onMouseDown: function(b) {
        if (b.button != 0) {
            return;
        }
        if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
            this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer" }, null, null, null);
        } else {
            this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer" }, null, null, null);
        }
        this._map.addLayer(this._drawLayer);
        this._pixX = SuperMap.Web.Utility.getMouseX(b) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(b) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        var a = new SuperMap.Web.Core.GeoPoint(this._mapPoint);
        this._style = new SuperMap.Web.Core.Style();
        if (this._map.get_theme() == null) {
            this._style.fill = true;
            this._style.stroke = true;
            this._style.fillColor = "#97dff9";
            this._style.strokeColor = "#1799c9";
            this._style.lineWidth = 2;
        } else {
            this._style.fill = true;
            this._style.stroke = true;
            this._style.fillColor = this._map.get_theme().get_color();
            this._style.strokeColor = this._map.get_theme().get_stroke();
            this._style.lineWidth = this._map.get_theme().get_strokeThickness();
            this._style.opacity = this._map.get_theme().get_opacity();
            this._style.pointRadius = this._map.get_theme().get_size();
        }
        this._point = a;
        if (this._actionStarted == false) {
            this._id = "tempFeature";
            this._feature = new SuperMap.Web.Core.Feature();
            this._feature.geometry = this._point;
            this._feature.style = this._style;
            this._feature.id = this._id;
            this._drawLayer.addFeature(this._feature);
        }
        this._actionStarted = true;
    },
    onMouseMove: function(b) {
        if (this._actionStarted === true) {
            this._pixX = SuperMap.Web.Utility.getMouseX(b) - this._containerX;
            this._pixY = SuperMap.Web.Utility.getMouseY(b) - this._containerY;
            this._pixPoint.x = this._pixX;
            this._pixPoint.y = this._pixY;
            this._mapPoint = this._map.screenToMap(this._pixPoint);
            var a = new SuperMap.Web.Core.GeoPoint(this._mapPoint);
            this._point = a;
            this._feature = this._drawLayer.modifyFeature(this._id, a, null);
        }
    },
    onMouseUp: function(b) {
        if (b.button != 0) {
            return;
        }
        var a = new SuperMap.Web.Actions.DrawGeometryArgs("DrawPoint", this._point, this._style, b);
        if (!this._drawLayer) {
            return;
        }
        this._map.removeLayer(this._drawLayer);
        this._drawLayer = null;
        this._actionStarted = false;
        this.raise_actionCompleted(a);
    },
    onDblClick: function(a) {
    }
};
SuperMap.Web.Actions.DrawPoint.registerClass("SuperMap.Web.Actions.DrawPoint", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawCircle = function() {
    SuperMap.Web.Actions.DrawCircle.initializeBase(this);
    this._type = "DrawCircleAction";
    this._actionStarted = false;
    this._mapDiv = null;
    this._containerX = null;
    this._containerY = null;
    this._centerPoint = new SuperMap.Web.Core.GeoPoint();
    this._circle = null;
    this._radius = 0;
    this._geoRadius = 0;
    this._title = null;
    this._oldPixX = null;
    this._oldPixY = null;
};
SuperMap.Web.Actions.DrawCircle.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/CircleQuery.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onMouseDown: function(b) {
        if (b.button != 0) {
            return;
        }
        if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
            this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer" }, null, null, null);
        } else {
            this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer" }, null, null, null);
        }
        this._map.addLayer(this._drawLayer);
        this._pixX = SuperMap.Web.Utility.getMouseX(b) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(b) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        var a = new SuperMap.Web.Core.GeoPoint(this._mapPoint);
        this._circle = new SuperMap.Web.Core.GeoCircle(this._mapPoint, 0);
        this._createTitle(this._pixX, this._pixY);
        this._style = new SuperMap.Web.Core.Style();
        if (this._map.get_theme() == null) {
            this._style.fill = true;
            this._style.stroke = true;
            this._style.fillColor = "#97dff9";
            this._style.strokeColor = "#1799c9";
            this._style.lineWidth = 2;
            this._style.pointRadius = 0;
            this._style.opacity = "0.5";
        } else {
            this._style.fill = true;
            this._style.stroke = true;
            this._style.fillColor = this._map.get_theme().get_fill();
            this._style.strokeColor = this._map.get_theme().get_stroke();
            this._style.lineWidth = this._map.get_theme().get_strokeThickness();
            this._style.opacity = this._map.get_theme().get_opacity();
            this._style.pointRadius = this._map.get_theme().get_size();
        }
        this._centerPoint = a;
        this._id = "tempFeature";
        this._feature = new SuperMap.Web.Core.Feature();
        this._feature.geometry = this._circle;
        this._feature.style = this._style;
        this._feature.id = this._id;
        this._drawLayer.addFeature(this._feature);
        this._actionStarted = true;
        this._oldPixX = this._pixX;
        this._oldPixY = this._pixY;
        this._createCenterPoint();
    },
    onMouseMove: function(h) {
        if (this._actionStarted === true) {
            this._pixX = SuperMap.Web.Utility.getMouseX(h) - this._containerX;
            this._pixY = SuperMap.Web.Utility.getMouseY(h) - this._containerY;
            this._pixPoint.x = this._pixX;
            this._pixPoint.y = this._pixY;
            this._mapPoint = this._map.screenToMap(this._pixPoint);
            var i = new SuperMap.Web.Core.GeoPoint(this._mapPoint);
            var b = i.x - this._centerPoint.x;
            var a = i.y - this._centerPoint.y;
            this._geoRadius = Math.sqrt(b * b + a * a);
            var f = this._oldPixX - this._pixX;
            var c = this._oldPixY - this._pixY;
            this._radius = Math.sqrt(f * f + c * c);
            this._circle.geoRadius = this._geoRadius;
            this._feature = this._drawLayer.modifyFeature(this._id, this._circle, this._style, null);
            var g = Math.round(this._radius);
            var d = Math.round(this._geoRadius * 10000) / 10000;
            var j = "Radius:" + g + "px<br>GeoRadius:" + d;
            this._modifyTitle(this._pixX, this._pixY, j);
        }
    },
    onMouseUp: function(b) {
        if (b.button != 0) {
            return;
        }
        var a = new SuperMap.Web.Actions.DrawCircleArgs("DrawCircle", this._circle, this._style, b, this._radius);
        this._map.removeLayer(this._drawLayer);
        this._drawLayer = null;
        this._actionStarted = false;
        this._mapDiv.removeChild(this._title);
        this.raise_actionCompleted(a);
        this._radius = 0;
        this._geoRadius = 0;
    },
    _createTitle: function(a, b) {
        this._title = document.createElement("div");
        this._title.id = "radius_title";
        this._title.style.position = "absolute";
        this._title.style.top = (b + 10) + "px";
        this._title.style.left = (a + 10) + "px";
        this._title.style.border = "solid 1px black";
        this._title.style.backgroundColor = "white";
        this._title.style.width = "auto";
        this._title.style.height = "auto";
        this._title.style.overflow = "hidden";
        this._title.style.zIndex = 99;
        this._title.innerHTML = "Radius:0<br>GeoRadius:0";
        this._mapDiv.appendChild(this._title);
    },
    _modifyTitle: function(a, e, d) {
        var b = this._map.get_width();
        var c = this._map.get_height();
        a = a < (b - 120) ? a : b - 120;
        e = e < (c - 70) ? e : c - 70;
        a = a > 0 ? a : 0;
        e = e > 0 ? e : 0;
        this._title.style.top = (e + 10) + "px";
        this._title.style.left = (a + 10) + "px";
        this._title.innerHTML = d;
    },
    _createCenterPoint: function() {
        var b = new SuperMap.Web.Core.Style();
        b.fill = true;
        b.stroke = false;
        b.fillColor = "black";
        b.lineWidth = 0;
        b.pointRadius = 2;
        var a = new SuperMap.Web.Core.Feature();
        a.geometry = this._centerPoint;
        a.style = b;
        this._drawLayer.addFeature(a);
    }
};
SuperMap.Web.Actions.DrawCircle.registerClass("SuperMap.Web.Actions.DrawCircle", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawEllipse = function() {
    SuperMap.Web.Actions.DrawEllipse.initializeBase(this);
    this._type = "DrawEllipseAction";
    this._actionStarted = false;
    this._mapDiv = null;
    this._containerX = null;
    this._containerY = null;
    this._centerPoint = new SuperMap.Web.Core.GeoPoint();
    this._ellipse = null;
    this._xRadius = 0;
    this._yRadius = 0;
    this._xGeoRadius = 0;
    this._yGeoRadius = 0;
    this._title = null;
    this._oldPixX = null;
    this._oldPixY = null;
};
SuperMap.Web.Actions.DrawEllipse.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/CircleQuery.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onMouseDown: function(b) {
        if (b.button != 0) {
            return;
        }
        if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
            this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer" }, null, null, null);
        } else {
            this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer" }, null, null, null);
        }
        this._map.addLayer(this._drawLayer);
        this._pixX = SuperMap.Web.Utility.getMouseX(b) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(b) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        var a = new SuperMap.Web.Core.GeoPoint(this._mapPoint);
        this._ellipse = new SuperMap.Web.Core.GeoEllipse(this._mapPoint, 0, 0);
        this._createTitle(this._pixX, this._pixY);
        this._style = new SuperMap.Web.Core.Style();
        if (this._map.get_theme() == null) {
            this._style.fill = true;
            this._style.stroke = true;
            this._style.fillColor = "#97dff9";
            this._style.strokeColor = "#1799c9";
            this._style.lineWidth = 2;
            this._style.pointRadius = 0;
            this._style.opacity = "0.5";
        } else {
            this._style.fill = true;
            this._style.stroke = true;
            this._style.fillColor = this._map.get_theme().get_fill();
            this._style.strokeColor = this._map.get_theme().get_stroke();
            this._style.lineWidth = this._map.get_theme().get_strokeThickness();
            this._style.opacity = this._map.get_theme().get_opacity();
            this._style.pointRadius = this._map.get_theme().get_size();
        }
        this._centerPoint = a;
        this._id = "tempFeature";
        this._feature = new SuperMap.Web.Core.Feature();
        this._feature.geometry = this._ellipse;
        this._feature.style = this._style;
        this._feature.id = this._id;
        this._drawLayer.addFeature(this._feature);
        this._actionStarted = true;
        this._oldPixX = this._pixX;
        this._oldPixY = this._pixY;
        this._createCenterPoint();
    },
    onMouseMove: function(h) {
        if (this._actionStarted === true) {
            this._pixX = SuperMap.Web.Utility.getMouseX(h) - this._containerX;
            this._pixY = SuperMap.Web.Utility.getMouseY(h) - this._containerY;
            this._pixPoint.x = this._pixX;
            this._pixPoint.y = this._pixY;
            this._mapPoint = this._map.screenToMap(this._pixPoint);
            var j = new SuperMap.Web.Core.GeoPoint(this._mapPoint);
            var b = j.x - this._centerPoint.x;
            var a = j.y - this._centerPoint.y;
            var f = this._oldPixX - this._pixX;
            var d = this._oldPixY - this._pixY;
            this._xRadius = Math.abs(f);
            this._yRadius = Math.abs(d);
            this._xGeoRadius = Math.abs(b);
            this._yGeoRadius = Math.abs(a);
            this._ellipse.xGeoRadius = this._xGeoRadius;
            this._ellipse.yGeoRadius = this._yGeoRadius;
            this._feature = this._drawLayer.modifyFeature(this._id, this._ellipse, this._style, null);
            var i = Math.round(this._xRadius);
            var g = Math.round(this._yRadius);
            var l = Math.round(this._xGeoRadius * 10000) / 10000;
            var c = Math.round(this._yGeoRadius * 10000) / 10000;
            var k = "xRadius:" + i + "px<br>yRadius:" + g + "px<br>xGeoRadius:" + l + "<br>yGeoRadius:" + c;
            this._modifyTitle(this._pixX, this._pixY, k);
        }
    },
    onMouseUp: function(b) {
        if (b.button != 0) {
            return;
        }
        var a = new SuperMap.Web.Actions.DrawEllipseArgs("DrawEllipse", this._ellipse, this._style, b, this._xRadius, this._yRadius);
        this._map.removeLayer(this._drawLayer);
        this._drawLayer = null;
        this._actionStarted = false;
        this._mapDiv.removeChild(this._title);
        this.raise_actionCompleted(a);
        this._radius = 0;
        this._geoRadius = 0;
    },
    _createTitle: function(a, b) {
        this._title = document.createElement("div");
        this._title.id = "radius_title";
        this._title.style.position = "absolute";
        this._title.style.top = (b + 10) + "px";
        this._title.style.left = (a + 10) + "px";
        this._title.style.border = "solid 1px black";
        this._title.style.backgroundColor = "white";
        this._title.style.width = "auto";
        this._title.style.height = "auto";
        this._title.style.overflow = "hidden";
        this._title.style.zIndex = 99;
        this._title.innerHTML = "SRadius:0<br>GRadius:0";
        this._mapDiv.appendChild(this._title);
    },
    _modifyTitle: function(a, e, d) {
        var b = this._map.get_width();
        var c = this._map.get_height();
        a = a < (b - 120) ? a : b - 120;
        e = e < (c - 70) ? e : c - 70;
        a = a > 0 ? a : 0;
        e = e > 0 ? e : 0;
        this._title.style.top = (e + 10) + "px";
        this._title.style.left = (a + 10) + "px";
        this._title.innerHTML = d;
    },
    _createCenterPoint: function() {
        var b = new SuperMap.Web.Core.Style();
        b.fill = true;
        b.stroke = false;
        b.fillColor = "black";
        b.lineWidth = 0;
        b.pointRadius = 2;
        var a = new SuperMap.Web.Core.Feature();
        a.geometry = this._centerPoint;
        a.style = b;
        this._drawLayer.addFeature(a);
    }
};
SuperMap.Web.Actions.DrawEllipse.registerClass("SuperMap.Web.Actions.DrawEllipse", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.MeasureDistance = function() {
    SuperMap.Web.Actions.MeasureDistance.initializeBase(this);
    this._type = "MeasureDistanceAction";
    this._mapDiv = null;
    this._containerX = null;
    this._containerY = null;
    this._line = new SuperMap.Web.Core.GeoLine();
    this._line.parts[0] = [];
    this._feature = null;
    this._drawLayer = null;
    this._actionStarted = false;
    this._title = null;
    this._oldPixX = null;
    this._oldPixY = null;
};
SuperMap.Web.Actions.MeasureDistance.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        this._line = null;
        this._mapDiv = null;
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/MeasureDistance.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onClick: function(a) {
        if (a.button != 0) {
            return;
        }
        if (this._drawLayer === null) {
            if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
                this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer" }, null, null, null);
            } else {
                this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer" }, null, null, null);
            }
            this._map.addLayer(this._drawLayer);
        }
        this._pixX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        this._line.parts[0].push(this._mapPoint);
        if (this._oldPixX == this._pixX && this._oldPixY == this._pixY) {
            return;
        }
        this._oldPixX = this._pixX;
        this._oldPixY = this._pixY;
        if (this._actionStarted == false) {
            this._style = new SuperMap.Web.Core.Style();
            if (this._map.get_theme() == null) {
                this._style.stroke = true;
                this._style.strokeColor = "#1799c9";
                this._style.lineWidth = 2;
                this._style.fill = false;
            } else {
                this._style.stroke = true;
                this._style.strokeColor = this._map.get_theme().get_stroke();
                this._style.lineWidth = this._map.get_theme().get_strokeThickness();
                this._style.fill = false;
            }
            this._id = "tempFeature";
            this._feature = new SuperMap.Web.Core.Feature();
            this._feature.geometry = this._line;
            this._feature.style = this._style;
            this._feature.id = this._id;
            this._drawLayer.addFeature(this._feature);
            this._createTitle(this._pixX, this._pixY);
        } else {
            this._drawLayer.modifyFeature(this._id, this._line);
        }
        this._actionStarted = true;
    },
    onMouseMove: function(f) {
        if (this._actionStarted === true) {
            var h = SuperMap.Web.Utility.getMouseX(f) - this._containerX;
            var g = SuperMap.Web.Utility.getMouseY(f) - this._containerY;
            var a = new SuperMap.Web.Core.Point();
            a.x = h;
            a.y = g;
            var d = this._map.screenToMap(a);
            var c = new SuperMap.Web.Core.GeoLine();
            c.parts[0] = this._line.parts[0].concat(d);
            this._drawLayer.modifyFeature(this._id, c, null);
            var b = this._calculateDistance(c.parts[0]);
            this._modifyTitle(h, g, "总长：" + b + "<br>单击确定起点，双击结束");
        }
    },
    onDblClick: function(d) {
        if (d.button != 0) {
            return;
        }
        this._map.removeLayer(this._drawLayer);
        this._drawLayer = null;
        this._actionStarted = false;
        this._mapDiv.removeChild(this._title);
        var c = new SuperMap.Web.Core.GeoLine();
        c.parts[0] = this._line.parts[0];
        this._line.parts[0] = [];
        var b = this._calculateDistance(c.parts[0]);
        var a = new SuperMap.Web.Actions.MeasureDistanceArgs("DrawLine", c, this._style, d, b);
        this.raise_actionCompleted(a);
    },
    _createTitle: function(a, b) {
        this._title = document.createElement("div");
        this._title.id = "radius_title";
        this._title.style.position = "absolute";
        this._title.style.top = (b + 10) + "px";
        this._title.style.left = (a + 10) + "px";
        this._title.style.border = "solid 1px black";
        this._title.style.backgroundColor = "white";
        this._title.style.width = "auto";
        this._title.style.height = "auto";
        this._title.style.overflow = "hidden";
        this._title.style.zIndex = 99;
        this._title.style.fontSize = "10px";
        this._title.innerHTML = "总长：0米<br>单击确定地点，双击结束";
        this._mapDiv.appendChild(this._title);
    },
    _modifyTitle: function(a, c, b) {
        this._title.style.top = (c + 10) + "px";
        this._title.style.left = (a + 10) + "px";
        this._title.innerHTML = b;
    },
    _calculateDistance: function(a) {
        var b = null;
        var e = 0;
        var d = 0;
        for (var c = 0; c < a.length - 1; c++) {
            e = Math.abs(a[c + 1].x - a[c].x);
            d = Math.abs(a[c + 1].y - a[c].y);
            b += Math.sqrt(e * e + d * d);
        }
        b = b.toString().split(".")[0];
        if (parseFloat(b) / 1000 >= 1) {
            b = (parseFloat(b) / 1000).toFixed(1) + "公里";
        } else {
            b = b + "米";
        }
        return b;
    }
};
SuperMap.Web.Actions.MeasureDistance.registerClass("SuperMap.Web.Actions.MeasureDistance", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawLine = function() {
    SuperMap.Web.Actions.DrawLine.initializeBase(this);
    this._type = "DrawLineAction";
    this._mapDiv = null;
    this._line = new SuperMap.Web.Core.GeoLine();
    this._line.parts[0] = new Array();
    this._feature = null;
    this._drawLayer = null;
    this._containerX = null;
    this._containerY = null;
    this._actionStarted = false;
    this._point2Ds = new Array();
    this._oldPixX = null;
    this._oldPixY = null;
};
SuperMap.Web.Actions.DrawLine.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        this._line = null;
        this._mapDiv = null;
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/LineQuery.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onClick: function(a) {
        if (a.button != 0) {
            return;
        }
        if (this._drawLayer === null) {
            if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
                this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer", bounds: new SuperMap.Web.Core.Rectangle2D(48, -7668, 8958, -78) }, null, null, null);
            } else {
                this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer", bounds: new SuperMap.Web.Core.Rectangle2D(48, -7668, 8958, -78) }, null, null, null);
            }
            this._map.addLayer(this._drawLayer);
        }
        this._pixX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        this._line.parts[0].push(this._mapPoint);
        if (this._oldPixX == this._pixX && this._oldPixY == this._pixY) {
            return;
        }
        this._oldPixX = this._pixX;
        this._oldPixY = this._pixY;
        if (this._actionStarted == false) {
            this._style = new SuperMap.Web.Core.Style();
            if (this._map.get_theme() == null) {
                this._style.stroke = true;
                this._style.strokeColor = "#1799c9";
                this._style.lineWidth = 2;
                this._style.fill = false;
            } else {
                this._style.stroke = true;
                this._style.strokeColor = this._map.get_theme().get_stroke();
                this._style.lineWidth = this._map.get_theme().get_strokeThickness();
                this._style.fill = false;
            }
            this._id = "tempFeature";
            this._feature = new SuperMap.Web.Core.Feature();
            this._feature.geometry = this._line;
            this._feature.style = this._style;
            this._feature.id = this._id;
            this._drawLayer.addFeature(this._feature);
        } else {
            this._drawLayer.modifyFeature(this._id, this._line);
        }
        this._actionStarted = true;
    },
    onMouseMove: function(d) {
        if (this._actionStarted === true) {
            var g = SuperMap.Web.Utility.getMouseX(d) - this._containerX;
            var f = SuperMap.Web.Utility.getMouseY(d) - this._containerY;
            var a = new SuperMap.Web.Core.Point();
            a.x = g;
            a.y = f;
            var c = this._map.screenToMap(a);
            var b = new SuperMap.Web.Core.GeoLine();
            b.parts[0] = this._line.parts[0].concat(c);
            this._feature = this._drawLayer.modifyFeature(this._id, b, null);
        }
    },
    onDblClick: function(c) {
        if (c.button != 0) {
            return;
        }
        this._map.removeLayer(this._drawLayer);
        this._drawLayer = null;
        this._actionStarted = false;
        var b = new SuperMap.Web.Core.GeoLine();
        b.parts[0] = this._line.parts[0];
        this._line.parts[0] = new Array();
        var a = new SuperMap.Web.Actions.DrawGeometryArgs("DrawLine", b, this._style, c);
        this.raise_actionCompleted(a);
    }
};
SuperMap.Web.Actions.DrawLine.registerClass("SuperMap.Web.Actions.DrawLine", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawPolygon = function() {
    SuperMap.Web.Actions.DrawPolygon.initializeBase(this);
    this._mapDiv = null;
    this._type = "DrawPolygonAction";
    this._region = new SuperMap.Web.Core.GeoRegion();
    this._region.parts[0] = new Array();
    this._drawLayer = null;
    this._containerX = null;
    this._containerY = null;
    this._actionStarted = false;
    this._oldPixX = null;
    this._oldPixY = null;
};
SuperMap.Web.Actions.DrawPolygon.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        this._region = null;
        this._mapDiv = null;
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/RectQuery.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onClick: function(a) {
        if (a.button != 0) {
            return;
        }
        if (this._drawLayer === null) {
            if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
                this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer" }, null, null, null);
            } else {
                this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer" }, null, null, null);
            }
            this._map.addLayer(this._drawLayer);
        }
        this._pixX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        this._region.parts[0].push(this._mapPoint);
        if (this._oldPixX == this._pixX && this._oldPixY == this._pixY) {
            return;
        }
        this._oldPixX = this._pixX;
        this._oldPixY = this._pixY;
        if (this._actionStarted == false) {
            this._style = new SuperMap.Web.Core.Style();
            if (this._map.get_theme() == null) {
                this._style.stroke = true;
                this._style.strokeColor = "#1799c9";
                this._style.lineWidth = 1;
                this._style.fill = true;
                this._style.fillColor = "#97dff9";
                this._style.opacity = "0.5";
            } else {
                this._style.stroke = true;
                this._style.fill = true;
                this._style.strokeColor = this._map.get_theme().get_stroke();
                this._style.lineWidth = this._map.get_theme().get_strokeThickness();
                this._style.fillColor = this._map.get_theme().get_fill();
                this._style.opacity = this._map.get_theme().get_opacity();
            }
            this._id = "tempFeature";
            this._feature = new SuperMap.Web.Core.Feature();
            this._feature.geometry = this._region;
            this._feature.style = this._style;
            this._feature.id = this._id;
            this._drawLayer.addFeature(this._feature);
        } else {
            this._drawLayer.modifyFeature(this._id, this._region);
        }
        this._actionStarted = true;
    },
    onMouseMove: function(d) {
        if (this._actionStarted === true) {
            var g = SuperMap.Web.Utility.getMouseX(d) - this._containerX;
            var f = SuperMap.Web.Utility.getMouseY(d) - this._containerY;
            var b = new SuperMap.Web.Core.Point();
            b.x = g;
            b.y = f;
            var c = this._map.screenToMap(b);
            var a = new SuperMap.Web.Core.GeoRegion();
            a.parts[0] = this._region.parts[0].concat(c);
            this._drawLayer.modifyFeature(this._id, a, null);
        }
    },
    onDblClick: function(c) {
        if (c.button != 0) {
            return;
        }
        if (Sys.Browser.name === "Firefox") {
            this._region.parts[0].pop();
        }
        this._map.removeLayer(this._drawLayer);
        this._drawLayer = null;
        this._actionStarted = false;
        var b = new SuperMap.Web.Core.GeoRegion();
        b.parts[0] = this._region.parts[0];
        this._region.parts[0] = new Array();
        var a = new SuperMap.Web.Actions.DrawGeometryArgs("DrawPolygon", b, this._style, c);
        this.raise_actionCompleted(a);
    }
};
SuperMap.Web.Actions.DrawPolygon.registerClass("SuperMap.Web.Actions.DrawPolygon", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawRectangle = function() {
    SuperMap.Web.Actions.DrawRectangle.initializeBase(this);
    this._mapDiv = null;
    this._type = "DrawRectangleAction";
    this._region = new SuperMap.Web.Core.GeoRegion();
    this._region.parts[0] = new Array();
    this._drawLayer = null;
    this._containerX = null;
    this._containerY = null;
    this._actionStarted = false;
};
SuperMap.Web.Actions.DrawRectangle.prototype = {
    dispose: function() {
        if (this._drawLayer) {
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            this._actionStarted = false;
        }
        this._region = null;
        this._mapDiv = null;
        if (this._map && this._map.get_element() != null) {
            this._map = null;
        }
    },
    initialize: function() {
        this._map.get_element().style.cursor = "url(scripts/libs/supermap/images/cur/PolygonQuery.cur),auto";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onMouseDown: function(a) {
        if (a.button != 0) {
            return;
        }
        if (this._drawLayer === null) {
            if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
                this._drawLayer = $create(SuperMap.Web.Mapping.SVGLayer, { id: "temDrawLayer" }, null, null, null);
            } else {
                this._drawLayer = $create(SuperMap.Web.Mapping.VMLLayer, { id: "temDrawLayer" }, null, null, null);
            }
            this._map.addLayer(this._drawLayer);
        }
        this._pixX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._mapPoint = this._map.screenToMap(this._pixPoint);
        this._region.parts[0].push(this._mapPoint);
        if (this._actionStarted == false) {
            this._style = new SuperMap.Web.Core.Style();
            if (this._map.get_theme() == null) {
                this._style.stroke = true;
                this._style.strokeColor = "#1799c9";
                this._style.lineWidth = 1;
                this._style.fill = true;
                this._style.fillColor = "#97dff9";
                this._style.opacity = "0.5";
            } else {
                this._style.stroke = true;
                this._style.fill = true;
                this._style.strokeColor = this._map.get_theme().get_stroke();
                this._style.lineWidth = this._map.get_theme().get_strokeThickness();
                this._style.fillColor = this._map.get_theme().get_fill();
                this._style.opacity = this._map.get_theme().get_opacity();
            }
            this._id = "tempFeature";
            this._feature = new SuperMap.Web.Core.Feature();
            this._feature.geometry = this._region;
            this._feature.style = this._style;
            this._feature.id = this._id;
            this._drawLayer.addFeature(this._feature);
        }
        this._actionStarted = true;
    },
    onMouseMove: function(f) {
        if (this._actionStarted === true) {
            var i = SuperMap.Web.Utility.getMouseX(f) - this._containerX;
            var g = SuperMap.Web.Utility.getMouseY(f) - this._containerY;
            var b = new SuperMap.Web.Core.Point();
            b.x = i;
            b.y = g;
            var d = this._map.screenToMap(b);
            var h = new SuperMap.Web.Core.Point2D(d.x, this._mapPoint.y);
            var c = new SuperMap.Web.Core.Point2D(this._mapPoint.x, d.y);
            var a = new SuperMap.Web.Core.GeoRegion();
            a.parts[0] = this._region.parts[0].concat(h, d, c);
            this._drawLayer.modifyFeature(this._id, a, null);
        }
    },
    onMouseUp: function(h) {
        if (h.button != 0) {
            return;
        }
        if (this._actionStarted === true) {
            var b = SuperMap.Web.Utility.getMouseX(h) - this._containerX;
            var a = SuperMap.Web.Utility.getMouseY(h) - this._containerY;
            var j = new SuperMap.Web.Core.Point();
            j.x = b;
            j.y = a;
            var c = this._map.screenToMap(j);
            var d = new SuperMap.Web.Core.Point2D(c.x, this._mapPoint.y);
            var i = new SuperMap.Web.Core.Point2D(this._mapPoint.x, c.y);
            var f = new SuperMap.Web.Core.GeoRegion();
            f.parts[0] = this._region.parts[0].concat(d, c, i);
            this._map.removeLayer(this._drawLayer);
            this._drawLayer = null;
            var g = new SuperMap.Web.Core.GeoRegion();
            g.parts[0] = f.parts[0];
            this._region.parts[0] = new Array();
            var k = new SuperMap.Web.Actions.DrawGeometryArgs("DrawRectangle", g, this._style, h);
            this.raise_actionCompleted(k);
        }
        this._actionStarted = false;
    },
    onDblClick: function(a) { return false; }
};
SuperMap.Web.Actions.DrawRectangle.registerClass("SuperMap.Web.Actions.DrawRectangle", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.PanFeatures = function() {
    SuperMap.Web.Actions.PanFeatures.initializeBase(this);
    this._type = "PanFeaturesAction";
    this._features = null;
    this._featuresLayer = null;
    this._pixX = 0;
    this._pixY = 0;
    this._actionStarted = false;
};
SuperMap.Web.Actions.PanFeatures.prototype = {
    get_features: function() { return this._features; },
    set_features: function(a) { this._features = a; },
    get_featuresLayer: function() { return this._featuresLayer; },
    set_featuresLayer: function(a) { this._featuresLayer = a; },
    initialize: function() {
        this._map.get_element().style.cursor = "pointer";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onMouseDown: function(a) {
        this._pixX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._oldMapPoint = this._map.screenToMap(this._pixPoint);
        this._actionStarted = true;
    },
    onMouseMove: function(l) {
        if (this._actionStarted == false) {
            return;
        }
        var a = this._computeOffsetXY(l);
        var k = a.offsetX;
        var g = a.offsetY;
        for (var h = 0; h < this._features.length; h++) {
            if (SuperMap.Web.Core.GeoPoint.isInstanceOfType(this._features[h].geometry)) {
                var n = this._features[h].geometry;
                var d = new SuperMap.Web.Core.Point2D();
                d.x = n.x + k;
                d.y = n.y + g;
                var o = new SuperMap.Web.Core.GeoPoint(d);
                this._featuresLayer.modifyFeature(this._features[h].id, o, null);
            } else {
                if (SuperMap.Web.Core.GeoLine.isInstanceOfType(this._features[h].geometry)) {
                    var c = new SuperMap.Web.Core.GeoLine();
                    c.parts[0] = new Array();
                    var b = this._features[h].geometry.parts[0];
                    for (var f = 0; f < b.length; f++) {
                        c.parts[0][f] = new SuperMap.Web.Core.Point2D();
                        c.parts[0][f].x = b[f].x + k;
                        c.parts[0][f].y = b[f].y + g;
                    }
                    this._featuresLayer.modifyFeature(this._features[h].id, c, null);
                } else {
                    if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(this._features[h].geometry)) {
                        var m = new SuperMap.Web.Core.GeoRegion();
                        m.parts[0] = new Array();
                        var b = this._features[h].geometry.parts[0];
                        for (var f = 0; f < b.length; f++) {
                            m.parts[0][f] = new SuperMap.Web.Core.Point2D();
                            m.parts[0][f].x = b[f].x + k;
                            m.parts[0][f].y = b[f].y + g;
                        }
                        this._featuresLayer.modifyFeature(this._features[h].id, m, null);
                    }
                }
            }
        }
    },
    onMouseUp: function(a) {
        this._features = null;
        this._actionStarted = false;
    },
    _computeOffsetXY: function(f) {
        var b = SuperMap.Web.Utility.getMouseX(f) - this._containerX;
        var i = SuperMap.Web.Utility.getMouseY(f) - this._containerY;
        var h = new SuperMap.Web.Core.Point();
        h.x = b;
        h.y = i;
        var d = this._map.screenToMap(h);
        var a = d.x - this._oldMapPoint.x;
        var g = d.y - this._oldMapPoint.y;
        this._oldMapPoint.x = d.x;
        this._oldMapPoint.y = d.y;
        var c = new Object();
        c.offsetX = a;
        c.offsetY = g;
        return c;
    }
};
SuperMap.Web.Actions.PanFeatures.registerClass("SuperMap.Web.Actions.PanFeatures", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.EditFeaturesNode = function() {
    SuperMap.Web.Actions.EditFeaturesNode.initializeBase(this);
    this._type = "EditFeaturesNodeAction";
    this._featuresAndIndex = null;
    this._featuresLayer = null;
    this._actionStarted = false;
};
SuperMap.Web.Actions.EditFeaturesNode.prototype = {
    get_featuresAndIndex: function() { return this._featuresAndIndex; },
    set_featuresAndIndex: function(a) { this._featuresAndIndex = a; },
    get_featuresLayer: function() { return this._featuresLayer; },
    set_featuresLayer: function(a) { this._featuresLayer = a; },
    initialize: function() {
        this._map.get_element().style.cursor = "pointer";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
    },
    onMouseDown: function(a) {
        this._pixX = SuperMap.Web.Utility.getMouseX(a) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(a) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        this._oldMapPoint = this._map.screenToMap(this._pixPoint);
        this._actionStarted = true;
    },
    onMouseMove: function(j) {
        if (this._actionStarted == false) {
            return;
        }
        var a = this._computeOffsetXY(j);
        var h = a.offsetX;
        var f = a.offsetY;
        for (var g = 0; g < this._featuresAndIndex.length; g++) {
            if (SuperMap.Web.Core.GeoPoint.isInstanceOfType(this._featuresAndIndex[g].feature.geometry)) {
                var l = this._featuresAndIndex[g].feature.geometry;
                var d = new SuperMap.Web.Core.Point2D();
                d.x = l.x + h;
                d.y = l.y + f;
                var m = new SuperMap.Web.Core.GeoPoint(d);
                this._featuresLayer.modifyFeature(this._featuresAndIndex[g].feature.id, m, null);
            } else {
                if (SuperMap.Web.Core.GeoLine.isInstanceOfType(this._featuresAndIndex[g].feature.geometry)) {
                    var c = this._featuresAndIndex[g].feature.geometry;
                    var b = this._featuresAndIndex[g].feature.geometry.parts[0];
                    c.parts[0][this._featuresAndIndex[g].index].x = b[this._featuresAndIndex[g].index].x + h;
                    c.parts[0][this._featuresAndIndex[g].index].y = b[this._featuresAndIndex[g].index].y + f;
                    this._featuresLayer.modifyFeature(this._featuresAndIndex[g].feature.id, c, null);
                } else {
                    if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(this._featuresAndIndex[g].feature.geometry)) {
                        var k = this._featuresAndIndex[g].feature.geometry;
                        var b = this._featuresAndIndex[g].feature.geometry.parts[0];
                        k.parts[0][this._featuresAndIndex[g].index].x = b[this._featuresAndIndex[g].index].x + h;
                        k.parts[0][this._featuresAndIndex[g].index].y = b[this._featuresAndIndex[g].index].y + f;
                        this._featuresLayer.modifyFeature(this._featuresAndIndex[g].feature.id, k, null);
                    }
                }
            }
        }
    },
    onMouseUp: function(a) {
        this._featuresAndIndex = null;
        this._actionStarted = false;
    },
    _computeOffsetXY: function(f) {
        var b = SuperMap.Web.Utility.getMouseX(f) - this._containerX;
        var i = SuperMap.Web.Utility.getMouseY(f) - this._containerY;
        var h = new SuperMap.Web.Core.Point();
        h.x = b;
        h.y = i;
        var d = this._map.screenToMap(h);
        var a = d.x - this._oldMapPoint.x;
        var g = d.y - this._oldMapPoint.y;
        this._oldMapPoint.x = d.x;
        this._oldMapPoint.y = d.y;
        var c = new Object();
        c.offsetX = a;
        c.offsetY = g;
        return c;
    }
};
SuperMap.Web.Actions.EditFeaturesNode.registerClass("SuperMap.Web.Actions.EditFeaturesNode", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.EditFeature = function() {
    SuperMap.Web.Actions.EditFeature.initializeBase(this);
    this._type = "EditFeatureAction";
    this._features = null, this._featuresLayer = null;
    this._feature = null;
    this._editFeature = null;
    this._mouseUpDelegate = Function.createDelegate(this, this.onMouseUp);
    this._onMouseOnFeatureDelegate = Function.createDelegate(this, this._onMouseOnFeature);
    this._onmousedownDelegate = Function.createDelegate(this, this._onMouseDownFeature);
    this._dblClickFeatureDelegate = Function.createDelegate(this, this._dblClickFeature);
    this._clickNewNodeDelegate = Function.createDelegate(this, this._clickNewNode);
    this._mouseOutEditPointDelegate = Function.createDelegate(this, this._mouseOutEditPoint);
    this._mouseOverEditPointDelegate = Function.createDelegate(this, this._mouseOverEditPoint);
    this._nodesIsShow = false;
    this._editFeatureLines = new Array();
    this._editFeaturePoints = new Array();
    this._featureBounds = null;
    this._curNewNode = null;
    this._moveOnLineNum = null;
    this._isMove = false;
    this._isDown = false;
    this._containerX = null;
    this._containerY = null;
    this.lineStyle = new SuperMap.Web.Core.Style();
    this.lineStyle.fill = false;
    this.lineStyle.stroke = true;
    this.lineStyle.strokeColor = "blue";
    this.lineStyle.lineWidth = 2;
    this.nodeStyle = new SuperMap.Web.Core.Style();
    this.nodeStyle.fill = true;
    this.nodeStyle.stroke = true;
    this.nodeStyle.fillColor = "red";
    this.nodeStyle.strokeColor = "red";
    this.nodeStyle.lineWidth = 1;
    this.mouseOverNodeStyle = new SuperMap.Web.Core.Style();
    this.mouseOverNodeStyle.fill = true;
    this.mouseOverNodeStyle.stroke = true;
    this.mouseOverNodeStyle.fillColor = "yellow";
    this.mouseOverNodeStyle.strokeColor = "black";
    this.mouseOverNodeStyle.lineWidth = 2;
    this._mapDiv = null;
};
SuperMap.Web.Actions.EditFeature.prototype = {
    get_featuresLayer: function() { return this._featuresLayer; },
    set_featuresLayer: function(a) { this._featuresLayer = a; },
    dispose: function() {
        if (!SuperMap.Web.Actions.EditFeature.isInstanceOfType(this._map.get_action())) {
            this._removeEvent();
        }
        this._submitEditFeature();
    },
    initialize: function() {
        this._map.get_element().style.cursor = "pointer";
        this._mapDiv = this._map.get_mapDiv();
        this._containerX = SuperMap.Web.Utility.getElementX(this._mapDiv);
        this._containerY = SuperMap.Web.Utility.getElementY(this._mapDiv);
        this._panFeaturesAction = $create(SuperMap.Web.Actions.PanFeatures, { map: map, featuresLayer: this._featuresLayer }, null, null, null);
        this._editFeatureNodeAction = $create(SuperMap.Web.Actions.EditFeaturesNode, { map: map, featuresLayer: this._featuresLayer }, null, null, null);
        this._features = this._featuresLayer.get_features();
        this.bindEventDelegate = Function.createDelegate(this, this._bindEvent);
        this._map.add_viewBoundsChanged(this.bindEventDelegate);
        this._bindEvent();
    },
    _onMouseOnFeature: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        this._moveOnLineNum = this._isClickLine(a);
    },
    _controlNewNode: function(v) {
        v = SuperMap.Web.Utility.getEvent(v);
        SuperMap.Web.Utility.cancelBubble(v);
        var g = SuperMap.Web.Utility.getMouseX(v) - this._containerX;
        var c = SuperMap.Web.Utility.getMouseY(v) - this._containerY;
        var q = this._editFeatureLines[this._moveOnLineNum].geometry.parts[0];
        var a = new SuperMap.Web.Core.Point2D(q[0].x, q[0].y);
        var E = new SuperMap.Web.Core.Point2D(q[1].x, q[1].y);
        var i = this._map.mapToScreen(a);
        var f = this._map.mapToScreen(E);
        var t = i.x;
        var d = i.y;
        var s = f.x;
        var b = f.y;
        if (t == s) {
            var B = t;
            var y = c;
            var j = Math.abs(g - B);
            if (d > b) {
                var w = d;
                var z = b;
            } else {
                var w = b;
                var z = d;
            }
            if (j > 5 || y > w || y < z) {
                this._hiddenNewNode();
                return;
            }
        } else {
            if (d == b) {
                var B = g;
                var y = d;
                var j = Math.abs(y - c);
                if (t > s) {
                    var x = t;
                    var A = s;
                } else {
                    var x = s;
                    var A = t;
                }
                if (j > 5 || B > x || B < A) {
                    this._hiddenNewNode();
                    return;
                }
            } else {
                if (t > s) {
                    var x = t;
                    var A = s;
                } else {
                    var x = s;
                    var A = t;
                }
                if (d > b) {
                    var w = d;
                    var z = b;
                } else {
                    var w = b;
                    var z = d;
                }
                var r = (b - d) / (s - t);
                var o = g;
                var D = b - r * (s - o);
                var p = Math.sqrt((o - g) * (o - g) + (D - c) * (D - c));
                var C = c;
                var m = s - (b - C) / r;
                var n = Math.sqrt((m - g) * (m - g) + (C - c) * (C - c));
                if (p < n) {
                    var j = p;
                    var B = o;
                    var y = D;
                } else {
                    var j = n;
                    var B = m;
                    var y = C;
                }
                if (j > 5 || (((y > w) && (B > x)) || ((y < z) && (B < A)) && r > 0) || (((y > w) && (B < A)) || ((y < z) && (B > x)) && r < 0)) {
                    this._hiddenNewNode();
                    return;
                }
            }
        }
        var l = new SuperMap.Web.Core.Point(B, y);
        var u = this._map.screenToMap(l);
        var h = new SuperMap.Web.Core.GeoPoint(u);
        this._showNewNode(h);
    },
    _clickNewNode: function(b) {
        b = SuperMap.Web.Utility.getEvent(b);
        SuperMap.Web.Utility.cancelBubble(b);
        var a = new SuperMap.Web.Core.Point2D(this._curNewNode.geometry.x, this._curNewNode.geometry.y);
        if (this._moveOnLineNum != null) {
            this._addNode(this._moveOnLineNum, a);
        }
    },
    _dblClickFeature: function(c) {
        c = SuperMap.Web.Utility.getEvent(c);
        SuperMap.Web.Utility.cancelBubble(c);
        if (c.button != 0) {
            return;
        }
        this._pixX = SuperMap.Web.Utility.getMouseX(c) - this._containerX;
        this._pixY = SuperMap.Web.Utility.getMouseY(c) - this._containerY;
        this._pixPoint = new SuperMap.Web.Core.Point();
        this._pixPoint.x = this._pixX;
        this._pixPoint.y = this._pixY;
        var b = this._map.screenToMap(this._pixPoint);
        var a = this._isClickPoint(c);
        if (a != null) {
            this._removeNode(a);
        }
    },
    _mouseOverEditPoint: function(c) {
        c = SuperMap.Web.Utility.getEvent(c);
        SuperMap.Web.Utility.cancelBubble(c);
        var a = this._isClickPoint(c);
        if (a != null) {
            if (this._map.get_theme()) {
                this.mouseOverNodeStyle = this._map.get_theme().get_snapStyle();
            }
            this._featuresLayer.modifyFeature(this._editFeaturePoints[a].id, null, this.mouseOverNodeStyle, null);
            if (SuperMap.Web.Mapping.SVGLayer.isInstanceOfType(this._featuresLayer)) {
                var b = document.getElementById(this._editFeaturePoints[a].id);
                b.onmousedown = this._onmousedownDelegate;
                b.ondblclick = this._dblClickFeatureDelegate;
                b.onmouseover = this._mouseOverEditPointDelegate;
                b.onmouseout = this._mouseOutEditPointDelegate;
            }
            this._hiddenNewNode();
        }
    },
    _mouseOutEditPoint: function(c) {
        c = SuperMap.Web.Utility.getEvent(c);
        SuperMap.Web.Utility.cancelBubble(c);
        var a = this._isClickPoint(c);
        if (a != null) {
            if (this._map.get_theme()) {
                this.nodeStyle = this._map.get_theme().get_hoverVertexStyle();
            }
            this._featuresLayer.modifyFeature(this._editFeaturePoints[a].id, null, this.nodeStyle, null);
            if (SuperMap.Web.Mapping.SVGLayer.isInstanceOfType(this._featuresLayer)) {
                var b = document.getElementById(this._editFeaturePoints[a].id);
                b.onmousedown = this._onmousedownDelegate;
                b.ondblclick = this._dblClickFeatureDelegate;
                b.onmouseover = this._mouseOverEditPointDelegate;
                b.onmouseout = this._mouseOutEditPointDelegate;
            }
        }
    },
    _onMouseDownFeature: function(k) {
        k = SuperMap.Web.Utility.getEvent(k);
        SuperMap.Web.Utility.cancelBubble(k);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            if (k.button != 1) {
                return;
            }
        } else {
            if (k.button != 0) {
                return;
            }
        }
        this._isDown = true;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            var a = k.srcElement.id;
        } else {
            var a = k.target.id;
        }
        for (var g = 0; g < this._features.length; g++) {
            if (this._features[g].id == a) {
                this._feature = this._features[g];
                break;
            }
        }
        var b = this._isClickLine(k);
        var m = this._isClickPoint(k);
        var l = this._isClickBounds(k);
        if (this._feature || m || l) {
            if (this._nodesIsShow == false || (l != true && m == null && this._feature.id != this._editFeature.id)) {
                if (b != null) {
                    return;
                }
                this._submitEditFeature(k);
                this._moveOnLineNum = null;
                this._displayEditLines(this._feature);
                this._displayEditPoints(this._feature);
                if (SuperMap.Web.Core.GeoLine.isInstanceOfType(this._feature.geometry)) {
                    this._drawBounds(this._feature);
                }
                this._editFeature = this._feature;
                this._nodesIsShow = true;
            } else {
                if (m != null) {
                    this._panFeaturesAction.set_features([this._editFeaturePoints[m]]);
                    this._panFeaturesAction.onMouseDown(k);
                    var h = new Array();
                    var f = new Object();
                    f.feature = this._editFeature;
                    f.index = m;
                    h.push(f);
                    var d = new Object();
                    var c = new Object();
                    if (m == 0) {
                        if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(this._editFeature.geometry)) {
                            d.feature = this._editFeatureLines[this._editFeatureLines.length - 1];
                            d.index = 1;
                            c.feature = this._editFeatureLines[m];
                            c.index = 0;
                        }
                        if (SuperMap.Web.Core.GeoLine.isInstanceOfType(this._editFeature.geometry)) {
                            c.feature = this._editFeatureLines[m];
                            c.index = 0;
                        }
                    } else {
                        if (m == (this._editFeaturePoints - 1)) {
                            if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(this._editFeature.geometry)) {
                                d.feature = this._editFeatureLines[m - 1];
                                d.index = 1;
                                c.feature = this._editFeatureLines[m];
                                c.index = 0;
                            }
                            if (SuperMap.Web.Core.GeoLine.isInstanceOfType(this._editFeature.geometry)) {
                                c.feature = this._editFeatureLines[m - 1];
                                c.index = 1;
                            }
                        } else {
                            d.feature = this._editFeatureLines[m - 1];
                            d.index = 1;
                            c.feature = this._editFeatureLines[m];
                            c.index = 0;
                        }
                    }
                    if (d.feature) {
                        h.push(d);
                    }
                    if (c.feature) {
                        h.push(c);
                    }
                    this._editFeatureNodeAction.set_featuresAndIndex(h);
                    this._editFeatureNodeAction.onMouseDown(k);
                } else {
                    var i = new Array();
                    i.push(this._editFeature);
                    if ((l || Sys.Browser.name != "Microsoft Internet Explorer") && SuperMap.Web.Core.GeoLine.isInstanceOfType(this._editFeature.geometry)) {
                        i = i.concat(this._featureBounds);
                    }
                    i = i.concat(this._editFeatureLines);
                    i = i.concat(this._editFeaturePoints);
                    this._panFeaturesAction.set_features(i);
                    this._panFeaturesAction.onMouseDown(k);
                }
            }
        }
        if (!(Sys.Browser.name == "Microsoft Internet Explorer")) {
            document.addEventListener("mouseup", this._mouseUpDelegate, true);
        }
    },
    onMouseDown: function(a) {
        if (a.button != 0) {
            return;
        }
        if (this._nodesIsShow == true) {
            this._submitEditFeature(a);
            this._moveOnLineNum = null;
        }
    },
    onMouseMove: function(a) {
        if (this._isDown == true) {
            this._isMove = true;
        }
        this._panFeaturesAction.onMouseMove(a);
        this._editFeatureNodeAction.onMouseMove(a);
        if (this._moveOnLineNum != null) {
            this._controlNewNode(a);
            if (SuperMap.Web.Mapping.SVGLayer.isInstanceOfType(this._featuresLayer) && this._curNewNode) {
                document.getElementById(this._curNewNode.id).onmousedown = this._clickNewNodeDelegate;
            }
        }
    },
    onMouseUp: function(a) {
        if (a.button != 0) {
            return;
        }
        this._isDown = false;
        this._panFeaturesAction.onMouseUp(a);
        this._editFeatureNodeAction.onMouseUp(a);
        if (this._editFeature && SuperMap.Web.Core.GeoLine.isInstanceOfType(this._editFeature.geometry)) {
            this._clearFeatureBounds();
            this._drawBounds(this._editFeature);
        }
        if (SuperMap.Web.Mapping.SVGLayer.isInstanceOfType(this._featuresLayer)) {
            if (this._isMove == true) {
                this._isMove = false;
                this._clearEditFeatureLines();
                this._clearEditPoints();
                this._displayEditLines(this._editFeature);
                this._displayEditPoints(this._editFeature);
                this._bindEvent();
            }
        }
    },
    _showNewNode: function(a) {
        if (this._curNewNode == null) {
            this._curNewNode = new SuperMap.Web.Core.Feature();
            this._curNewNode.id = "curNewNode";
            this._curNewNode.geometry = a;
            if (this._map.get_theme()) {
                this.nodeStyle = this._map.get_theme().get_hoverVertexStyle();
            }
            this._curNewNode.style = this.nodeStyle;
            this._featuresLayer.addFeature(this._curNewNode);
            var b = document.getElementById("curNewNode");
            b.onmouseover = function() { return false; };
            b.onmouseout = function() { return false; };
            b.onmousemove = function() { return false; };
            b.onmousedown = this._clickNewNodeDelegate;
            b.style.zIndex = 6;
        } else {
            this._featuresLayer.modifyFeature(this._curNewNode.id, a, null);
        }
    },
    _hiddenNewNode: function() {
        if (this._curNewNode != null) {
            this._featuresLayer.clearFeature(this._curNewNode.id);
            this._curNewNode = null;
        }
    },
    _displayEditLines: function(d) {
        var c = new Array();
        if (SuperMap.Web.Core.GeoPoint.isInstanceOfType(d.geometry)) {
            c[0] = d.geometry;
        } else {
            if (SuperMap.Web.Core.GeoLine.isInstanceOfType(d.geometry)) {
                c = d.geometry.parts[0];
            } else {
                if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(d.geometry)) {
                    c = d.geometry.parts[0];
                    var e = "editLines_" + (c.length - 1);
                    var b = this._defineEditFeatureLine(c, c.length - 1, 0, e);
                    this._editFeatureLines[c.length - 1] = b;
                }
            }
        }
        for (var a = 0; a < c.length - 1; a++) {
            var e = "editLines_" + a;
            var b = this._defineEditFeatureLine(c, a, a + 1, e);
            this._editFeatureLines[a] = b;
        }
    },
    _drawBounds: function(e) {
        var d = e.geometry.bounds();
        var g = 20 * this._map.get_resolution();
        if ((d.rightTop.x - d.leftBottom.x) <= 30 * this._map.get_resolution()) {
            d.leftBottom.x -= g;
            d.rightTop.x += g;
        }
        if ((d.rightTop.y - d.leftBottom.y) <= 30 * this._map.get_resolution()) {
            d.leftBottom.y -= g;
            d.rightTop.y += g;
        }
        var f = new SuperMap.Web.Core.GeoRegion();
        f.parts[0] = [new SuperMap.Web.Core.Point2D(d.leftBottom.x, d.rightTop.y), new SuperMap.Web.Core.Point2D(d.leftBottom.x, d.leftBottom.y), new SuperMap.Web.Core.Point2D(d.rightTop.x, d.leftBottom.y), new SuperMap.Web.Core.Point2D(d.rightTop.x, d.rightTop.y)];
        var b = new SuperMap.Web.Core.Feature();
        b.geometry = f;
        b.style = new SuperMap.Web.Core.Style();
        b.style.fill = true;
        b.style.stroke = false;
        b.style.fillColor = "#e8e8e8";
        b.style.strokeColor = "#e8e8e8";
        b.style.opacity = 0.1;
        b.id = "FeatureBounds";
        this._featuresLayer.addFeature(b);
        var c = this._featuresLayer.get_features();
        for (var a in c) {
            if (c[a].id == "FeatureBounds") {
                this._featureBounds = c[a];
                break;
            }
        }
        $get("FeatureBounds").onmousedown = this._onmousedownDelegate;
        $get("FeatureBounds").style.zIndex = -5;
    },
    _defineEditFeatureLine: function(c, g, d, f) {
        var b = new SuperMap.Web.Core.GeoLine();
        b.parts[0] = new Array();
        var a = new SuperMap.Web.Core.Point2D();
        a.x = c[g].x;
        a.y = c[g].y;
        var e = new SuperMap.Web.Core.Point2D();
        e.x = c[d].x;
        e.y = c[d].y;
        b.parts[0].push(a);
        b.parts[0].push(e);
        return this._drawEditLine(b, f);
    },
    _displayEditPoints: function(e) {
        var d = new Array();
        if (SuperMap.Web.Core.GeoPoint.isInstanceOfType(e.geometry)) {
            d[0] = e.geometry;
        } else {
            if (SuperMap.Web.Core.GeoLine.isInstanceOfType(e.geometry)) {
                d = e.geometry.parts[0];
            } else {
                if (SuperMap.Web.Core.GeoRegion.isInstanceOfType(e.geometry)) {
                    d = e.geometry.parts[0];
                }
            }
        }
        for (var c = 0; c < d.length; c++) {
            var f = new SuperMap.Web.Core.Point2D();
            f.x = d[c].x;
            f.y = d[c].y;
            var a = new SuperMap.Web.Core.GeoPoint(f);
            var g = "editPoints_" + c;
            var b = this._drawEditPoint(a, g);
            this._editFeaturePoints.push(b);
        }
    },
    _drawEditPoint: function(a, d) {
        var c = new SuperMap.Web.Core.Feature();
        c.geometry = a;
        if (this._map.get_theme()) {
            this.nodeStyle = this._map.get_theme().get_hoverVertexStyle();
        }
        c.style = this.nodeStyle;
        c.id = d;
        this._featuresLayer.addFeature(c);
        var b = document.getElementById(d);
        b.onmousedown = this._onmousedownDelegate;
        b.ondblclick = this._dblClickFeatureDelegate;
        b.onmouseover = this._mouseOverEditPointDelegate;
        b.onmouseout = this._mouseOutEditPointDelegate;
        b.style.zIndex = 6;
        return c;
    },
    _drawEditLine: function(c, d) {
        var b = new SuperMap.Web.Core.Feature();
        b.geometry = c;
        if (this._map.get_theme()) {
            this.lineStyle = this._map.get_theme().get_hoverLineStyle();
        }
        b.style = this.lineStyle;
        b.id = d;
        this._featuresLayer.addFeature(b);
        var a = document.getElementById(d);
        a.onmousedown = this._onmousedownDelegate;
        a.onmouseover = this._onMouseOnFeatureDelegate;
        a.style.zIndex = 5;
        return b;
    },
    _clearEditFeatureLines: function() {
        for (var a = 0; a < this._editFeatureLines.length; a++) {
            this._removeEditFeatureLine(a);
        }
        this._editFeatureLines = new Array();
    },
    _removeEditFeatureLine: function(a) { this._featuresLayer.clearFeature(this._editFeatureLines[a].id); },
    _clearEditPoints: function() {
        for (var a = 0; a < this._editFeaturePoints.length; a++) {
            this._removeEditPoint(a);
        }
        this._editFeaturePoints = new Array();
    },
    _clearFeatureBounds: function() {
        this._featuresLayer.clearFeature(this._featureBounds.id);
        this._featureBounds = null;
    },
    _removeEditPoint: function(a) { this._featuresLayer.clearFeature(this._editFeaturePoints[a].id); },
    _addNode: function(a, b) {
        this._editFeature.geometry.parts[0].splice(a + 1, 0, b);
        this._featuresLayer.modifyFeature(this._editFeature.id, this._editFeature.geometry, null, null);
        this._clearEditPoints();
        this._clearEditFeatureLines();
        this._displayEditLines(this._editFeature);
        this._displayEditPoints(this._editFeature);
    },
    _removeNode: function(a) {
        this._editFeature.geometry.parts[0].splice(a, 1);
        this._featuresLayer.modifyFeature(this._editFeature.id, this._editFeature.geometry, null);
        if (SuperMap.Web.Mapping.SVGLayer.isInstanceOfType(this._featuresLayer)) {
            document.getElementById(this._editFeature.id).onmousedown = this._onmousedownDelegate;
        }
        this._hiddenNewNode();
        this._moveOnLineNum = null;
        this._clearEditPoints();
        this._clearEditFeatureLines();
        this._displayEditLines(this._editFeature);
        this._displayEditPoints(this._editFeature);
    },
    _isClickPoint: function(d) {
        var c = false;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            var f = d.srcElement.id;
        } else {
            var f = d.target.id;
        }
        for (var b = 0; b < this._editFeaturePoints.length; b++) {
            if (f == this._editFeaturePoints[b].id) {
                c = true;
                var a = b;
                break;
            }
        }
        if (c == false) {
            return null;
        } else {
            return a;
        }
    },
    _isClickBounds: function(a) {
        var c = false;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            var b = a.srcElement.id;
        } else {
            var b = a.target.id;
        }
        if (b == "FeatureBounds") {
            c = true;
        }
        return c;
    },
    _isClickLine: function(d) {
        d = SuperMap.Web.Utility.getEvent(d);
        SuperMap.Web.Utility.cancelBubble(d);
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            var f = d.srcElement.id;
        } else {
            var f = d.target.id;
        }
        var c = false;
        for (var b = 0; b < this._editFeatureLines.length; b++) {
            if (f == this._editFeatureLines[b].id) {
                c = true;
                var a = b;
                break;
            }
        }
        if (c == false) {
            return null;
        } else {
            return a;
        }
    },
    _submitEditFeature: function(b) {
        if (this._editFeature != null) {
            var a = new SuperMap.Web.Actions.EditFeatureEventArgs("EditFeature", this._editFeature, b);
            this.raise_actionCompleted(a);
        }
        this._clearEditPoints();
        this._clearEditFeatureLines();
        if (this._editFeature && SuperMap.Web.Core.GeoLine.isInstanceOfType(this._editFeature.geometry)) {
            this._clearFeatureBounds();
        }
        this._editFeature = null;
        this._nodesIsShow = false;
    },
    _removeEvent: function() {
        for (var a = 0; a < this._features.length; a++) {
            var b = document.getElementById(this._features[a].id);
            if (b) {
                b.onmousedown = function() { return false; };
                b.ondblclick = function() { return false; };
            }
        }
        this._map.remove_viewBoundsChanged(this.bindEventDelegate);
    },
    _bindEvent: function() {
        for (var a = 0; a < this._features.length; a++) {
            var b = document.getElementById(this._features[a].id);
            if (b) {
                b.onmousedown = this._onmousedownDelegate;
            }
        }
        for (var a = 0; a < this._editFeatureLines.length; a++) {
            var b = document.getElementById(this._editFeatureLines[a].id);
            if (b) {
                b.ondblclick = this._dblClickFeatureDelegate;
                b.onmousedown = this._onmousedownDelegate;
                b.onmouseover = this._onMouseOnFeatureDelegate;
            }
        }
        for (var a = 0; a < this._editFeaturePoints.length; a++) {
            var b = document.getElementById(this._editFeaturePoints[a].id);
            if (b) {
                b.onmousedown = this._onmousedownDelegate;
                b.ondblclick = this._dblClickFeatureDelegate;
                b.onmouseover = this._mouseOverEditPointDelegate;
                b.onmouseout = this._mouseOutEditPointDelegate;
            }
        }
    }
};
SuperMap.Web.Actions.EditFeature.registerClass("SuperMap.Web.Actions.EditFeature", SuperMap.Web.Actions.MapAction, Sys.IDisposable);
SuperMap.Web.Actions.DrawGeometryArgs = function(a, d, b, c) { this.actionName = a, this.geometry = d, this.style = b, this.event = c; };
SuperMap.Web.Actions.DrawGeometryArgs.registerClass("SuperMap.Web.Actions.DrawGeometryArgs");
SuperMap.Web.Actions.DrawCircleArgs = function(b, e, c, d, a) {
    SuperMap.Web.Actions.DrawCircleArgs.initializeBase(this, [b, e, c, d]);
    this.radius = a;
};
SuperMap.Web.Actions.DrawCircleArgs.registerClass("SuperMap.Web.Actions.DrawCircleArgs", SuperMap.Web.Actions.DrawGeometryArgs);
SuperMap.Web.Actions.DrawEllipseArgs = function(b, f, c, d, e, a) {
    SuperMap.Web.Actions.DrawEllipseArgs.initializeBase(this, [b, f, c, d]);
    this.xRadius = a;
    this.yRadius = e;
};
SuperMap.Web.Actions.DrawEllipseArgs.registerClass("SuperMap.Web.Actions.DrawEllipseArgs", SuperMap.Web.Actions.DrawGeometryArgs);
SuperMap.Web.Actions.MeasureDistanceArgs = function(b, e, c, d, a) {
    SuperMap.Web.Actions.MeasureDistanceArgs.initializeBase(this, [b, e, c, d]);
    this.totalDistance = a;
};
SuperMap.Web.Actions.MeasureDistanceArgs.registerClass("SuperMap.Web.Actions.MeasureDistanceArgs", SuperMap.Web.Actions.DrawGeometryArgs);
SuperMap.Web.Actions.EditFeatureEventArgs = function(a, b, c) {
    this.actionName = a;
    this.feature = b;
    this.event = c;
};
SuperMap.Web.Actions.EditFeatureEventArgs.registerClass("SuperMap.Web.Actions.EditFeatureEventArgs");
Type.registerNamespace("SuperMap.Web");
SuperMap.Web.Utility = function() {
};
SuperMap.Web.Utility.registerClass("SuperMap.Web.Utility", null, Sys.IDisposable);
SuperMap.Web.Utility.GetBrowser = function() {
    var a = navigator.userAgent.toLowerCase();
    if (a.indexOf("opera") != -1) {
        return "opera";
    } else {
        if (a.indexOf("msie") != -1) {
            return "ie";
        } else {
            if (a.indexOf("safari") != -1) {
                return "safari";
            } else {
                if (a.indexOf("gecko") != -1) {
                    return "gecko";
                } else {
                    return false;
                }
            }
        }
    }
};
SuperMap.Web.Utility.isDebug = false;
SuperMap.Web.Utility.getEvent = function(a) { return a ? a : window.event; };
SuperMap.Web.Utility.getMouseX = function(a) {
    var b = 0;
    if (a.pageX) {
        b = a.pageX;
    } else {
        if (a.clientX) {
            if (document.documentElement && document.documentElement.scrollLeft) {
                b = a.clientX + document.documentElement.scrollLeft;
            } else {
                if (document.body) {
                    b = a.clientX + document.body.scrollLeft;
                }
            }
        }
    }
    return b;
};
SuperMap.Web.Utility.getMouseY = function(a) {
    var b = 0;
    if (a.pageY) {
        b = a.pageY;
    } else {
        if (a.clientY) {
            if (document.documentElement && document.documentElement.scrollTop) {
                b = a.clientY + document.documentElement.scrollTop;
            } else {
                if (document.body) {
                    b = a.clientY + document.body.scrollTop;
                }
            }
        }
    }
    return b;
};
SuperMap.Web.Utility.getMouseScrollDelta = function(a) {
    if (a.rawEvent.wheelDelta) {
        return a.rawEvent.wheelDelta;
    } else {
        if (a.rawEvent.detail) {
            return -a.rawEvent.detail;
        }
    }
    return 0;
};
SuperMap.Web.Utility.getTarget = function(b) {
    if (!b) {
        b = window.event;
    }
    var a = null;
    if (b.srcElement) {
        a = b.srcElement;
    } else {
        if (b.target) {
            a = b.target;
        }
    }
    if (a && a.nodeType) {
        if (a.nodeType == 3) {
            a = targ.parentNode;
        }
    }
    return a;
};
SuperMap.Web.Utility.cancelBubble = function(a) { a.cancelBubble = true; };
SuperMap.Web.Utility.getElementX = function(c) {
    var b = c;
    var a = 0;
    while (b) {
        a += b.offsetLeft;
        b = b.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && typeof(document.body.leftMargin) != "undefined") {
        a += document.body.leftMargin;
    }
    return a;
};
SuperMap.Web.Utility.getElementY = function(b) {
    var a = b;
    var c = 0;
    while (a) {
        c += a.offsetTop;
        a = a.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && typeof(document.body.topMargin) != "undefined") {
        c += document.body.topMargin;
    }
    return c;
};
SuperMap.Web.Utility.getMouseScrollDelta = function(a) {
    if (a.rawEvent.wheelDelta) {
        return a.rawEvent.wheelDelta;
    } else {
        if (a.rawEvent.detail) {
            return -a.rawEvent.detail;
        }
    }
    return 0;
};
SuperMap.Web.Utility.getXmlHttpRequest = function() {
    var a = null;
    try {
        a = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(b) {
        try {
            a = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(b) {
            a = null;
        }
    }
    if (!a && typeof XMLHttpRequest != "undefined") {
        a = new XMLHttpRequest();
    }
    return a;
};
SuperMap.Web.Utility.isInTheSameDomain = function(a) {
    if (!a) {
        return true;
    }
    var g = a.indexOf("//");
    var j = document.location.toString();
    var b = j.indexOf("//");
    if (g == -1) {
        return true;
    } else {
        var f = a.substring(0, g);
        var h = j.substring(b + 2);
        b = h.indexOf("/");
        documentDomainWithPort = h.substring(0, b);
        var k = document.location.protocol;
        if (k.toLowerCase() != f.toLowerCase()) {
            return false;
        }
        f = a.substring(g + 2);
        var c = f.indexOf(":");
        g = f.indexOf("/");
        var d = f.substring(0, c);
        var i = f.substring(0, g);
        var e = document.domain;
        if (d == e && i == documentDomainWithPort) {
            return true;
        }
    }
    return false;
};
SuperMap.Web.Utility.toJSON = function(f) {
    if (f == null) {
        return "null";
    }
    switch (f.constructor) {
    case String:
        var c = f;
        c = '"' + c.replace( /(["\\])/g , "\\$1") + '"';
        c = c.replace( /\n/g , "\\n");
        c = c.replace( /\r/g , "\\r");
        c = c.replace("<", "&lt;");
        c = c.replace(">", "&gt;");
        c = c.replace( /&/g , "%26");
        return c;
    case Array:
        var a = [];
        for (var b = 0; b < f.length; b++) {
            a.push(SuperMap.Web.Utility.toJSON(f[b]));
        }
        return "[" + a.join(", ") + "]";
    case Number:
        return isFinite(f) ? f.toString() : SuperMap.Web.Utility.toJSON(null);
    case Boolean:
        return f.toString();
    case Date:
        var e = new Object();
        e.__type = "System.DateTime";
        e.Year = f.getUTCFullYear();
        e.Month = f.getUTCMonth() + 1;
        e.Day = f.getUTCDate();
        e.Hour = f.getUTCHours();
        e.Minute = f.getUTCMinutes();
        e.Second = f.getUTCSeconds();
        e.Millisecond = f.getUTCMilliseconds();
        e.TimezoneOffset = f.getTimezoneOffset();
        return SuperMap.Web.Utility.toJSON(e);
    default:
        if (f.toJSON != null && typeof f.toJSON == "function") {
            return f.toJSON();
        }
        if (typeof f == "object") {
            if (f.length) {
                var a = [];
                for (var b = 0; b < f.length; b++) {
                    a.push(SuperMap.Web.Utility.toJSON(f[b]));
                }
                return "[" + a.join(", ") + "]";
            }
            var a = [];
            for (attr in f) {
                if (typeof f[attr] != "function") {
                    a.push('"' + attr + '":' + SuperMap.Web.Utility.toJSON(f[attr]));
                }
            }
            if (a.length > 0) {
                return "{" + a.join(", ") + "}";
            } else {
                return "{}";
            }
        }
        return f.toString();
    }
};
SuperMap.Web.Utility.fromJSON = function(c, b) {
    if (!b) {
        return;
    }
    for (var a in b) {
        if (typeof(c[a]) == "object") {
            SuperMap.Utility.fromJSON(c[a], b[a]);
        } else {
            if (typeof(c[a]) != "function" && typeof(c[a]) != "undefined") {
                c[a] = b[a];
            }
        }
    }
};
SuperMap.Web.Utility.getUnit = function(b) {
    var a = new SuperMap.Web.Core.Units();
    switch (b) {
    case a.meter:
        return "meter";
        break;
    case a.kilometer:
        return "kilometer";
        break;
    case a.mile:
        return "mile";
        break;
    case a.yard:
        return "yard";
        break;
    case a.degree:
        return "degree";
        break;
    case a.millimeter:
        return "millimeter";
        break;
    case a.centimeter:
        return "centimeter";
        break;
    case a.inch:
        return "inch";
        break;
    case a.decimeter:
        return "decimeter";
        break;
    case a.foot:
        return "foot";
        break;
    case a.second:
        return "second";
        break;
    case a.minute:
        return "minute";
        break;
    case a.radian:
        return "radian";
        break;
    default:
        return "??";
    }
};
SuperMap.Web.Utility.arraySortAsc = function(a) {
    a.sort(function(d, c) { return d - c; });
    return a;
};
SuperMap.Web.Utility.arraySortDesc = function(a) {
    a.sort(function(d, c) { return c - d; });
    return a;
};
SuperMap.Web.Utility.getDpi = function(g, c, a) {
    var j = 10000;
    var d = parseInt(Math.round(g.width() * j * a));
    var k = g.width() / c.width();
    var i = g.height() / c.height();
    var f = k > i ? k : i;
    if (d == 0) {
        var h = 0.0254 / f / a;
        return h;
    }
    var b = d / c.width();
    var e = 0.0254 / (b / j);
    return e;
};
SuperMap.Web.Utility.urlIsLong = function(c) {
    var d = 0;
    var b;
    var a;
    for (b = 0; b < c.length; b++) {
        a = c.charCodeAt(b);
        if (a < 127) {
            d = d + 1;
        } else {
            if ((128 <= a) && (a <= 2047)) {
                d += 2;
            } else {
                if ((2048 <= a) && (a <= 65535)) {
                    d += 3;
                }
            }
        }
    }
    if (d < 2000) {
        return false;
    } else {
        return true;
    }
};
SuperMap.Web.Utility.extendStyle = function(a) {
    var b = '<link type="text/css" rel="stylesheet" href="' + a + " />";
    document.writeln(b);
};
Type.registerNamespace("SuperMap.Web.Service");
SuperMap.Web.Service.Committer = function() {
};
SuperMap.Web.Service.Committer.commitMapCmd = function(a, g, f, d, c, b, e) { SuperMap.Web.Service.Committer.commitAjax(a, SuperMap.Web.Service.Committer.handler, g, f, d, false, c, b, e); };
SuperMap.Web.Service.Committer.commitAjax = function(m, b, e, h, k, o, r, g, d) {
    var m = encodeURI(m);
    var t = "";
    if (typeof(e) == "string") {
        t += "<uis><command><name>" + e + "</name>";
        t += "<parameter>";
        t += "<mapName>";
        t += m;
        t += "</mapName>";
        if (typeof(h) != "undefined" && h != null && typeof(k) != "undefined" && k != null) {
            var q, j;
            j = Math.min(h.length, k.length);
            for (q = 0; q < j; q++) {
                var l;
                if (k[q] != "undefined" && k[q] != null) {
                    if (typeof(k[q]) == "string" && k[q].length > 0) {
                        var n;
                        n = /%/g ;
                        n = /&/g ;
                        l = encodeURIComponent(k[q]);
                    } else {
                        if (typeof(k[q]) == "object") {
                            l = SuperMap.Web.Utility.toJSON(k[q]);
                        } else {
                            l = k[q];
                        }
                    }
                } else {
                    l = "";
                }
                t += "<" + h[q] + ">";
                t += l;
                t += "</" + h[q] + ">";
            }
        }
        t += "</parameter>";
        t += "</command></uis>";
    } else {
        if (typeof(e) == "array") {
            t += "%3Cuis%3E";
            for (var q = 0; q < e.length; q++) {
                t += "%3Ccommand%3E%3Cname%3E" + e[q] + "%3C%2Fname%3E";
                t += "%3Cparameter%3E";
                t += "%3CmapName%3E";
                t += m;
                t += "%3C%2FmapName%3E";
                var c = h.pop();
                var p = k.pop();
                if (typeof(c) != "undefined" && c != null && typeof(p) != "undefined" && p != null) {
                    var q, j;
                    j = Math.min(c.length, p.length);
                    for (q = 0; q < j; q++) {
                        var l;
                        if (p[q] != "undefined" && p[q] != null) {
                            if (typeof(p[q]) == "string" && p[q].length > 0) {
                                var n;
                                n = /%/g ;
                                n = /&/g ;
                                l = encodeURIComponent(p[q]);
                            } else {
                                if (typeof(p[q]) == "object") {
                                    l = SuperMap.Web.Utility.toJSON(p[q]);
                                } else {
                                    l = p[q];
                                }
                            }
                        } else {
                            l = "";
                        }
                        t += "%3C" + c[q] + "%3E";
                        t += l;
                        t += "%3C%2F" + c[q] + "%3E";
                    }
                }
                t += "%3C%2Fparameter%3E";
                t += "%3C%2Fcommand%3E";
            }
            t += "%3C%2Fuis%3E";
        }
    }
    var a = "";
    if (typeof(e) == "string") {
        a = e;
    } else {
        if (typeof(e) == "object") {
            a = SuperMap.Web.Utility.toJSON(e);
        }
    }
    if (SuperMap.Web.Utility.isInTheSameDomain(b)) {
        var s = new SuperMap.Web.Service.XHRSender(b, "mapName=" + m + "&params=" + t + "&method=" + a + "&t=" + new Date().getTime());
        return s.send(r, g, o, d);
    } else {
        var f = new SuperMap.Web.Service.JSONPSender(b, r, g, d);
        f.addQueryStrings(["mapName", "params", "method", "t"], [m, t, a, new Date().getTime()]);
        return f.send();
    }
};
SuperMap.Web.Service.Committer.REST = function(a, n, s, b, q, c, m, p) {
    var a = encodeURI(a);
    var f = a.substr(a.length - 1, 1);
    if (SuperMap.Web.Utility.isInTheSameDomain(a)) {
        if (n == "GET") {
            if (b) {
                var d = b.length;
                var e = "";
                for (var h = 0; h < d; h++) {
                    e += b[h] + "=" + q[h] + "&";
                }
                var o = SuperMap.Web.Utility.urlIsLong(e);
                if (o) {
                    n = "POST";
                    a += "_method=GET";
                    s = "{";
                    for (var g = 0; g < d; g++) {
                        s += '"' + b[g] + '":' + encodeURIComponent(q[g]) + ",";
                    }
                    s += "}";
                } else {
                    a += e;
                }
            }
        }
        switch (n) {
        case "GET":
            var r = new SuperMap.Web.Service.RESTSender(a, s);
            return r.send(c, m, true, p);
        case "POST":
            var r = new SuperMap.Web.Service.RESTSender(a, s);
            return r.send(c, m, false, p);
        case "PUT":
            if (f == "?") {
                a = a + "_method=PUT";
            } else {
                a = a + "&_method=PUT";
            }
            var r = new SuperMap.Web.Service.RESTSender(a, s);
            return r.send(c, m, false, p);
        case "DELETE":
            if (f == "?") {
                a = a + "_method=DELETE";
            } else {
                a = a + "&_method=DELETE";
            }
            var r = new SuperMap.Web.Service.RESTSender(a, s);
            return r.send(c, m, false, p);
        }
    } else {
        switch (n) {
        case "GET":
            var k = new SuperMap.Web.Service.RESTJsonpSender(a, c, m, p);
            k.addQueryStrings(b, q);
            return k.send();
        case "POST":
            if (f == "?") {
                a = a + "_method=POST";
            } else {
                a = a + "&_method=POST";
            }
            var k = new SuperMap.Web.Service.RESTJsonpSender(a, c, m, p);
            k.addQueryStrings(["requestEntity"], [s]);
            return k.send();
        case "PUT":
            if (f == "?") {
                a = a + "_method=PUT";
            } else {
                a = a + "&_method=PUT";
            }
            var k = new SuperMap.Web.Service.RESTJsonpSender(a, c, m, p);
            k.addQueryStrings(["requestEntity"], [s]);
            return k.send();
        case "DELETE":
            if (f == "?") {
                a = a + "_method=DELETE";
            } else {
                a = a + "&_method=DELETE";
            }
            var k = new SuperMap.Web.Service.RESTJsonpSender(a, c, m, p);
            if (s) {
                k.addQueryStrings(["requestEntity"], [s]);
            }
            return k.send();
        }
    }
};
SuperMap.Web.Service.Committer.registerClass("SuperMap.Web.Service.Committer", null, Sys.IDisposable);
SuperMap.Web.Service.XHRSender = function(a, b) {
    this.url = a;
    this.requestParams = b;
};
SuperMap.Web.Service.XHRSender.prototype = {
    send: function(onComplete, onError, isSynchronized, userContext) {
        var xhr = SuperMap.Web.Utility.getXmlHttpRequest();
        if (isSynchronized) {
            xhr.open("get", this.url + "?" + this.requestParams, !isSynchronized);
            xhr.send(null);
            if (xhr.status == 200) {
                if (xhr.responseText && xhr.responseText != "") {
                    var responseText = eval("(" + xhr.responseText + ")");
                    if (responseText) {
                        if (onComplete) {
                            return onComplete(responseText, userContext);
                        }
                    } else {
                        if (onError) {
                            return onError(xhr.responseText, userContext);
                        }
                    }
                } else {
                    if (onError) {
                        return onError(xhr.responseText, userContext);
                    }
                }
            } else {
                if (xhr.status == 400) {
                    if (onError) {
                        if (xhr.responseText && xhr.responseText != "") {
                            var responseText = eval("(" + xhr.responseText + ")");
                        }
                        return onError(responseText, userContext);
                    }
                }
            }
        } else {
            xhr.open("post", this.url, !isSynchronized);
            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            xhr.onreadystatechange = function() {
                var readyState = xhr.readyState;
                if (readyState == 4) {
                    var status = xhr.status;
                    if (status == 200) {
                        if (!xhr.responseText || xhr.responseText == "") {
                            if (onComplete) {
                                if (onComplete instanceof Array) {
                                    while (onComplete.length > 0) {
                                        var tempOnComplete = onComplete.pop();
                                        if (tempOnComplete) {
                                            tempOnComplete(null, userContext);
                                        }
                                    }
                                    onComplete = null;
                                } else {
                                    onComplete(null, userContext);
                                }
                            }
                            return;
                        }
                        var responseText = eval("(" + xhr.responseText + ")");
                        if (onComplete) {
                            if (onComplete instanceof Array) {
                                while (onComplete.length > 0) {
                                    var tempOnComplete = onComplete.pop();
                                    if (tempOnComplete) {
                                        tempOnComplete(responseText, userContext);
                                    }
                                }
                                onComplete = null;
                            } else {
                                onComplete(responseText, userContext);
                            }
                        }
                    } else {
                        if (onError) {
                            if (xhr.responseText && xhr.responseText != "") {
                                var responseText = eval("(" + xhr.responseText + ")");
                            }
                            onError(responseText, userContext);
                        }
                    }
                    xhr.onreadystatechange = function() {
                    };
                    xhr = null;
                }
            };
            xhr.send(this.requestParams);
        }
    }
};
SuperMap.Web.Service.XHRSender.registerClass("SuperMap.Web.Service.XHRSender", null, Sys.IDisposable);
SuperMap.Web.Service.RESTSender = function(a, b) {
    this.url = a;
    this.requestParams = b;
};
SuperMap.Web.Service.RESTSender.prototype = {
    send: function(onComplete, onError, isSynchronized, userContext) {
        var xhr = SuperMap.Web.Utility.getXmlHttpRequest();
        if (isSynchronized) {
            xhr.open("get", this.url, !isSynchronized);
            xhr.send(null);
            if (xhr.status == 200) {
                if (xhr.responseText && xhr.responseText != "") {
                    try {
                        var responseText = eval("(" + xhr.responseText + ")");
                    } catch(e) {
                        var responseText = xhr.responseText;
                    }
                    if (responseText) {
                        if (onComplete) {
                            return onComplete(responseText, userContext);
                        }
                    } else {
                        if (onError) {
                            return onError(xhr.responseText, userContext);
                        }
                    }
                } else {
                    if (onError) {
                        return onError(xhr.responseText, userContext);
                    }
                }
            } else {
                if (xhr.status == 400) {
                    if (onError) {
                        if (xhr.responseText && xhr.responseText != "") {
                            try {
                                var responseText = eval("(" + xhr.responseText + ")");
                            } catch(e) {
                                var responseText = xhr.responseText;
                            }
                        }
                        return onError(responseText, userContext);
                    }
                }
            }
        } else {
            xhr.open("post", this.url, !isSynchronized);
            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            xhr.onreadystatechange = function() {
                var readyState = xhr.readyState;
                if (readyState == 4) {
                    var status = xhr.status;
                    if (status == 200 || status == 201) {
                        if (!xhr.responseText || xhr.responseText == "") {
                            if (onComplete) {
                                if (onComplete instanceof Array) {
                                    while (onComplete.length > 0) {
                                        var tempOnComplete = onComplete.pop();
                                        if (tempOnComplete) {
                                            tempOnComplete(null, userContext);
                                        }
                                    }
                                    onComplete = null;
                                } else {
                                    onComplete(null, userContext);
                                }
                            }
                            return;
                        }
                        try {
                            var responseText = eval("(" + xhr.responseText + ")");
                        } catch(e) {
                            var responseText = xhr.responseText;
                        }
                        if (onComplete) {
                            if (onComplete instanceof Array) {
                                while (onComplete.length > 0) {
                                    var tempOnComplete = onComplete.pop();
                                    if (tempOnComplete) {
                                        tempOnComplete(responseText, userContext);
                                    }
                                }
                                onComplete = null;
                            } else {
                                onComplete(responseText, userContext);
                            }
                        }
                    } else {
                        if (onError) {
                            if (xhr.responseText && xhr.responseText != "") {
                                try {
                                    var responseText = eval("(" + xhr.responseText + ")");
                                } catch(e) {
                                    var responseText = xhr.responseText;
                                }
                            }
                            onError(responseText, userContext);
                        }
                    }
                    xhr.onreadystatechange = function() {
                    };
                    xhr = null;
                }
            };
            xhr.send(this.requestParams);
        }
    }
};
SuperMap.Web.Service.RESTSender.registerClass("SuperMap.Web.Service.RESTSender", null, Sys.IDisposable);
var supermap_callbacks = { };
SuperMap.Web.Service.JSONPSender = function(a, c, b, d) {
    this.url = a;
    if (c) {
        this.onComplete = c;
    }
    this.onError = b;
    this.userContext = d;
    this._queryKeys = null;
    this._queryValues = null;
    this._splitQuestUrl = null;
    this._limitLength = 1500;
    if (Sys.Browser.name != "Microsoft Internet Explorer") {
        this._limitLength = 3200;
    }
};
SuperMap.Web.Service.JSONPSender.prototype = {
    addQueryString: function(a, b) {
        if (this._queryKeys == null) {
            this._queryKeys = new Array();
        }
        if (this._queryValues == null) {
            this._queryValues = new Array();
        }
        this._queryKeys.push(a);
        this._queryValues.push(b);
    },
    addQueryStrings: function(d, a) {
        if (!d || d.length <= 0) {
            return;
        }
        if (!a || a.length <= 0) {
            return;
        }
        if (d.length != a.length) {
            return;
        }
        if (this._queryKeys == null) {
            this._queryKeys = new Array();
        }
        if (this._queryValues == null) {
            this._queryValues = new Array();
        }
        for (var b = 0; b < d.length; b++) {
            this._queryKeys.push(d[b]);
            if (typeof(a[b]) == "string") {
                if (Sys.Browser.name == "Microsoft Internet Explorer" && Sys.Browser.version == 6) {
                    var c = encodeURIComponent(a[b]);
                    this._queryValues.push(c);
                } else {
                    this._queryValues.push(a[b]);
                }
            } else {
                this._queryValues.push(SuperMap.Web.Utility.toJSON(a[b]));
            }
        }
    },
    send: function() {
        if (this.url.length > this._limitLength) {
            return false;
        }
        var f = new Date().getTime();
        var h = Math.floor(Math.random() * 10000);
        f = f * 10000 + h;
        var j;
        if (this.onComplete) {
            if (this.onComplete instanceof Array) {
                j = new Array();
                for (var d = 0; d < this.onComplete.length; d++) {
                    if (this.onComplete[d]) {
                        var k = Function.createDelegate(this, this.onComplete[d]);
                        j.push(k);
                    }
                }
            } else {
                j = Function.createDelegate(this, this.onComplete);
            }
        }
        var g = this.userContext;
        supermap_callbacks[f] = function(o) {
            if (j) {
                if (j instanceof Array) {
                    for (var n = 0; n < j.length; n++) {
                        j[n](o, g);
                    }
                } else {
                    j(o, g);
                }
            }
            delete supermap_callbacks[f];
        };
        this.addQueryString("jsonp", "supermap_callbacks[" + f + "]");
        var b = this.url;
        var c = 0;
        if (this._queryKeys && this._queryKeys.length > 0) {
            for (var d = 0; d < this._queryKeys.length; d++) {
                if (b.length + this._queryKeys[d].length + 2 >= this._limitLength) {
                    if (c == 0) {
                        return false;
                    }
                    if (this._splitQuestUrl == null) {
                        this._splitQuestUrl = new Array();
                    }
                    this._splitQuestUrl.push(b);
                    b = this.url;
                    c = 0;
                    d--;
                } else {
                    if (b.length + this._queryKeys[d].length + 2 + this._queryValues[d].length > this._limitLength) {
                        var a = this._queryValues[d];
                        while (a.length > 0) {
                            var l = this._limitLength - b.length - this._queryKeys[d].length - 2;
                            if (b.indexOf("?") > -1) {
                                b += "&";
                            } else {
                                b += "?";
                            }
                            var e = a.substring(0, l);
                            if (e.substring(l - 1, l) == "%") {
                                l -= 1;
                                e = a.substring(0, l);
                            } else {
                                if (e.substring(l - 2, l - 1) == "%") {
                                    l -= 2;
                                    e = a.substring(0, l);
                                }
                            }
                            var m;
                            m = /%/g ;
                            m = /&/g ;
                            m = /</g ;
                            e = e.replace(m, "%3C");
                            m = /#/g ;
                            e = e.replace(m, "%23");
                            m = />/g ;
                            e = e.replace(m, "%3E");
                            m = /[/]/g ;
                            e = e.replace(m, "%2F");
                            b += this._queryKeys[d] + "=" + e;
                            a = a.substring(l);
                            if (e.length > 0) {
                                if (this._splitQuestUrl == null) {
                                    this._splitQuestUrl = new Array();
                                }
                                this._splitQuestUrl.push(b);
                                b = this.url;
                                c = 0;
                            }
                        }
                    } else {
                        c++;
                        if (b.indexOf("?") > -1) {
                            b += "&";
                        } else {
                            b += "?";
                        }
                        var e = this._queryValues[d];
                        var m;
                        m = /%/g ;
                        m = /&/g ;
                        m = /</g ;
                        e = e.replace(m, "%3C");
                        m = /#/g ;
                        e = e.replace(m, "%23");
                        m = /[+]/g ;
                        e = e.replace(m, "%2b");
                        m = />/g ;
                        e = e.replace(m, "%3E");
                        m = /[/]/g ;
                        e = e.replace(m, "%2F");
                        b += this._queryKeys[d] + "=" + e;
                    }
                }
            }
            if (this._splitQuestUrl == null) {
                this._splitQuestUrl = new Array();
            }
            this._splitQuestUrl.push(b);
        }
        return this._sendInternal();
    },
    _sendInternal: function() {
        if (this._splitQuestUrl && this._splitQuestUrl.length > 0) {
            var d = new Date().getTime();
            for (var c = 0; c < this._splitQuestUrl.length; c++) {
                var a = document.createElement("script");
                var b = this._splitQuestUrl[c];
                if (b.indexOf("?") > -1) {
                    b += "&";
                } else {
                    b += "?";
                }
                b += "sectionCount=" + this._splitQuestUrl.length;
                b += "&sectionIndex=" + c;
                b += "&jsonpUserID=" + d;
                a.setAttribute("src", b);
                a.setAttribute("type", "text/javascript");
                if (navigator.userAgent.indexOf("IE") >= 0) {
                    a.onreadystatechange = function() {
                        if (this && ("loaded" == this.readyState || "complete" == this.readyState)) {
                            this.onreadystatechange = null;
                            try {
                                document.body.removeChild(this);
                            } catch(f) {
                                if (this.parentNode) {
                                    this.parentNode.removeChild(this);
                                }
                                delete this;
                            }
                        }
                    };
                } else {
                    a.onload = function() {
                        this.onload = null;
                        document.body.removeChild(this);
                    };
                }
                document.body.appendChild(a);
            }
            return true;
        }
    }
};
SuperMap.Web.Service.JSONPSender.registerClass("SuperMap.Web.Service.JSONPSender", null, Sys.IDisposable);
SuperMap.Web.Service.RESTJsonpSender = function(a, c, b, d) { SuperMap.Web.Service.RESTJsonpSender.initializeBase(this, [a, c, b, d]); };
SuperMap.Web.Service.RESTJsonpSender.prototype = {
    addQueryStrings: function(d, a) {
        if (!d || d.length <= 0) {
            return;
        }
        if (!a || a.length <= 0) {
            return;
        }
        if (d.length != a.length) {
            return;
        }
        if (this._queryKeys == null) {
            this._queryKeys = new Array();
        }
        if (this._queryValues == null) {
            this._queryValues = new Array();
        }
        for (var b = 0; b < d.length; b++) {
            this._queryKeys.push(d[b]);
            if (typeof(a[b]) == "string") {
                var c = encodeURIComponent(a[b]);
                c = c.replace("%3D", "&eq;");
                this._queryValues.push(c);
            } else {
                this._queryValues.push(SuperMap.Web.Utility.toJSON(a[b]));
            }
        }
    },
    createDelegate: function(c) {
        var a;
        if (c instanceof Array) {
            a = new Array();
            for (var d = 0; d < c.length; d++) {
                if (c[d]) {
                    var b = Function.createDelegate(this, c[d]);
                    a.push(b);
                }
            }
        } else {
            a = Function.createDelegate(this, c);
        }
        return a;
    },
    send: function() {
        if (this.url.length > this._limitLength) {
            return false;
        }
        var f = new Date().getTime();
        var h = Math.floor(Math.random() * 10000);
        f = f * 10000 + h;
        var j;
        if (this.onComplete) {
            j = this.createDelegate(this.onComplete);
        }
        var m;
        if (this.onError) {
            m = this.createDelegate(this.onError);
        }
        var g = this.userContext;
        supermap_callbacks[f] = function(p, q) {
            var o = q && q >= 400 ? m : j;
            if (o) {
                if (o instanceof Array) {
                    for (var n = 0; n < o.length; n++) {
                        o[n](p, g);
                    }
                } else {
                    o(p, g);
                }
            }
            delete supermap_callbacks[f];
        };
        this.addQueryString("callback", "supermap_callbacks[" + f + "]");
        var b = this.url;
        var c = 0;
        if (this._queryKeys && this._queryKeys.length > 0) {
            for (var d = 0; d < this._queryKeys.length; d++) {
                if (b.length + this._queryKeys[d].length + 2 >= this._limitLength) {
                    if (c == 0) {
                        return false;
                    }
                    if (this._splitQuestUrl == null) {
                        this._splitQuestUrl = new Array();
                    }
                    this._splitQuestUrl.push(b);
                    b = this.url;
                    c = 0;
                    d--;
                } else {
                    if (b.length + this._queryKeys[d].length + 2 + this._queryValues[d].length > this._limitLength) {
                        var a = this._queryValues[d];
                        while (a.length > 0) {
                            var k = this._limitLength - b.length - this._queryKeys[d].length - 2;
                            if (b.indexOf("?") > -1) {
                                b += "&";
                            } else {
                                b += "?";
                            }
                            var e = a.substring(0, k);
                            if (e.substring(k - 1, k) == "%") {
                                k -= 1;
                                e = a.substring(0, k);
                            } else {
                                if (e.substring(k - 2, k - 1) == "%") {
                                    k -= 2;
                                    e = a.substring(0, k);
                                }
                            }
                            var l;
                            l = /%/g ;
                            l = /&/g ;
                            l = /=/g ;
                            e = e.replace(l, "&eq;");
                            l = /</g ;
                            e = e.replace(l, "%3C");
                            l = /#/g ;
                            e = e.replace(l, "%23");
                            l = /[+]/g ;
                            e = e.replace(l, "%2b");
                            l = />/g ;
                            e = e.replace(l, "%3E");
                            l = /[/]/g ;
                            e = e.replace(l, "%2F");
                            b += this._queryKeys[d] + "=" + e;
                            a = a.substring(k);
                            if (e.length > 0) {
                                if (this._splitQuestUrl == null) {
                                    this._splitQuestUrl = new Array();
                                }
                                this._splitQuestUrl.push(b);
                                b = this.url;
                                c = 0;
                            }
                        }
                    } else {
                        c++;
                        if (b.indexOf("?") > -1) {
                            b += "&";
                        } else {
                            b += "?";
                        }
                        var e = this._queryValues[d];
                        var l;
                        l = /%/g ;
                        l = /&/g ;
                        l = /=/g ;
                        e = e.replace(l, "&eq;");
                        l = /</g ;
                        e = e.replace(l, "%3C");
                        l = /#/g ;
                        e = e.replace(l, "%23");
                        l = /[+]/g ;
                        e = e.replace(l, "%2b");
                        l = />/g ;
                        e = e.replace(l, "%3E");
                        l = /[/]/g ;
                        e = e.replace(l, "%2F");
                        b += this._queryKeys[d] + "=" + e;
                    }
                }
            }
            if (this._splitQuestUrl == null) {
                this._splitQuestUrl = new Array();
            }
            this._splitQuestUrl.push(b);
        }
        return this._sendInternal();
    }
};
SuperMap.Web.Service.RESTJsonpSender.registerClass("SuperMap.Web.Service.RESTJsonpSender", SuperMap.Web.Service.JSONPSender, Sys.IDisposable);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.ControlBase = function() {
    SuperMap.Web.Controls.ControlBase.initializeBase(this);
    this._map;
    this._id;
};
SuperMap.Web.Controls.ControlBase.prototype = {
    get_map: function() { return this._map; }, get_id: function() { return this._id; },
    initialize: function(a) {
    },
    dispose: function() {
    }
};
SuperMap.Web.Controls.ControlBase.registerClass("SuperMap.Web.Controls.ControlBase", Sys.Component);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.OverviewMap = function(a) {
    SuperMap.Web.Controls.OverviewMap.initializeBase(this);
    this._map = null;
    a = this._extend(a);
    this._id = a.id;
    this._pos = a.pos;
    this._size = a.size;
    this._layer = a.layer;
    this._multiple = a.multiple;
    this._scales = a.scales;
    this._createTemplete();
    this._mouseDownDelegate = Function.createDelegate(this, this._mouseDown);
    this._mouseUpDelegate = Function.createDelegate(this, this._mouseUp);
    this._mouseMoveDelegate = Function.createDelegate(this, this._mouseMove);
    this._viewBoundsChangedDelegate = Function.createDelegate(this, this._viewBoundsChanged);
    this._panAnimatedDelegate = Function.createDelegate(this, this._panAnimated);
    this._overViewPanByPixelDelegate = Function.createDelegate(this, this._overViewPanByPixel);
};
SuperMap.Web.Controls.OverviewMap.prototype = {
    get_height: function() { return this._size.height; },
    get_width: function() { return this._size.width; },
    get_layer: function() { return this._layer; },
    get_level: function() { return this._overViewMap.get_level(); },
    get_resolution: function() { return this._overViewMap.get_resolution(); },
    get_scale: function() { return this._overViewMap.get_scale(); },
    get_scales: function() { return this._scales; },
    hide: function() { this._overViewContainer.style.display = "none"; },
    show: function() { this._overViewContainer.style.display = "block"; },
    resize: function(b, a) {
        this._size.width = b || this._size.width;
        this._size.height = a || this._size.height;
        this._overViewContainer.style.height = this._size.height + "px";
        this._overViewContainer.style.width = this._size.width + "px";
    },
    initialize: function(c) {
        this._map = c;
        this._map._workLayer.appendChild(this._overViewContainer);
        this._overViewMap = $create(SuperMap.Web.Mapping.Map, { }, null, null, this._overViewContainer);
        this._overViewMap.setLayers([this._layer]);
        this._overViewMap.set_scales(this._scales);
        this._overViewMap._action = null;
        this._getPosition();
        this._resolutions = this._map.get_resolutions();
        var b = this._map.get_resolution() * this._multiple;
        var a = this._map.get_center();
        this._zoomToResolution(b, a);
        this._initIndexBox();
        this._map.add_viewBoundsChanged(this._viewBoundsChangedDelegate);
    },
    dispose: function() {
        var a = this._map && this._map._workLayer;
        if (a) {
            a.removeChild(this._overViewContainer);
        }
    },
    _extend: function(a) {
        if (!a.layer) {
            throw new Error("Layer is null!");
        }
        if (!a.size) {
            a.size = { width: 200, height: 200 };
        }
        if (!a.pos) {
            a.pos = new SuperMap.Web.Core.Point(0, 0);
        }
        if (!a.scales) {
            a.scales = [];
        }
        if (!a.multiple) {
            a.multiple = 10;
        }
        if (!a.id) {
            throw new Error("OverviewMap's id is null!");
        }
        return a;
    },
    _createTemplete: function() {
        this._overViewContainer = document.createElement("div");
        this._overViewContainer.id = this._id;
        this._overViewContainer.style.position = "absolute";
        this._overViewContainer.style.height = this._size.height + "px";
        this._overViewContainer.style.width = this._size.width + "px";
        this._overViewContainer.style.zIndex = 99;
        this._overViewContainer.style.border = "solid gray 3px";
        this._overViewContainer.style.right = this._pos.x + "px";
        this._overViewContainer.style.bottom = this._pos.y + "px";
    },
    _viewBoundsChanged: function() {
        var c = this._map.get_isZooming();
        if (c) {
            var b = this._map.get_resolution() * this._multiple;
            var a = this._map.get_center();
            this._zoomToResolution(b, a);
            this._refershIndexBox();
        } else {
            if (this._map._panActionMark) {
                this._refershIndexBox();
            } else {
                var a = this._map.get_center();
                this._stepCenters = this._computePanStep(a);
                this._panAnimated(0);
            }
        }
    },
    _sto: function(e, c, d) {
        var a = Array.prototype.slice.call(arguments, 2);
        var b = function() { e.apply(this, a); };
        return window.setTimeout(b, c);
    },
    _computePanStep: function(b) {
        this._center = this._overViewMap.get_viewBounds().center();
        var a = (b.x - this._center.x) / 5;
        var e = (b.y - this._center.y) / 5;
        var d = new Array();
        for (var c = 1; c <= 5; c++) {
            d.push(new SuperMap.Web.Core.Point2D(this._center.x + a * c, this._center.y + e * c));
        }
        return d;
    },
    _panAnimated: function(a) {
        this._overViewMap.panTo(this._stepCenters[a]);
        if (a < 5) {
            this._sto(this._panAnimatedDelegate, 50, a + 1);
            this._refershIndexBox();
        }
    },
    _overViewPanByPixel: function(a, b) { this._overViewMap.panByPixel(a, b); },
    _mouseDown: function(e) {
        e = SuperMap.Web.Utility.getEvent(e);
        SuperMap.Web.Utility.cancelBubble(e);
        this._lastAction = this._map._action;
        this._map._action = null;
        this._ib_s = this._getEventPosition(e);
        var is = this._indexBox.style;
        this._ib_x = (is.left + "").replace("px", "");
        this._ib_x = this._ib_x.replace("pt", "");
        this._ib_x = eval(this._ib_x);
        this._ib_y = (is.top + "").replace("px", "");
        this._ib_y = this._ib_y.replace("pt", "");
        this._ib_y = eval(this._ib_y);
        this._indexAction = true;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            document.attachEvent("onmousemove", this._mouseMoveDelegate);
            document.attachEvent("onmouseup", this._mouseUpDelegate);
        } else {
            document.addEventListener("mousemove", this._mouseMoveDelegate, true);
            document.addEventListener("mouseup", this._mouseUpDelegate, true);
        }
        return false;
    },
    _siv: function(e, c, d) {
        var a = Array.prototype.slice.call(arguments, 2);
        var b = function() { e.apply(this, a); };
        return window.setInterval(b, c);
    },
    _mouseMove: function(i) {
        if (this._indexAction) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
            this._ib_m = this._getEventPosition(i);
            var g = this._ib_m.x - this._ib_s.x;
            var c = this._ib_m.y - this._ib_s.y;
            var f = this._indexBox.style;
            f.left = this._ib_x + g + "px";
            f.top = this._ib_y + c + "px";
            var d = SuperMap.Web.Utility.getElementX(this._indexBox);
            var l = d + this._indexBox.clientWidth;
            var a = SuperMap.Web.Utility.getElementX(this._overViewContainer);
            var j = a + this._overViewContainer.clientWidth;
            var m = SuperMap.Web.Utility.getElementY(this._indexBox);
            var h = m + this._indexBox.clientHeight;
            var b = SuperMap.Web.Utility.getElementY(this._overViewContainer);
            var k = b + this._overViewContainer.clientHeight;
            if (this._interId) {
                window.clearInterval(this._interId);
            }
            if (d <= a) {
                if (m <= b) {
                    this._interId = this._siv(this._overViewPanByPixelDelegate, 10, -1, -1);
                } else {
                    if (h >= k) {
                        this._interId = this._siv(this._overViewPanByPixelDelegate, 10, -1, 1);
                    } else {
                        this._interId = this._siv(this._overViewPanByPixelDelegate, 10, -1, 0);
                    }
                }
            } else {
                if (l >= j) {
                    if (m <= b) {
                        this._interId = this._siv(this._overViewPanByPixelDelegate, 10, 1, -1);
                    } else {
                        if (h >= k) {
                            this._interId = this._siv(this._overViewPanByPixelDelegate, 10, 1, 1);
                        } else {
                            this._interId = this._siv(this._overViewPanByPixelDelegate, 10, 1, 0);
                        }
                    }
                } else {
                    if (m <= b) {
                        this._interId = this._siv(this._overViewPanByPixelDelegate, 10, 0, -1);
                    } else {
                        if (h >= k) {
                            this._interId = this._siv(this._overViewPanByPixelDelegate, 10, 0, 1);
                        } else {
                            window.clearInterval(this._interId);
                        }
                    }
                }
            }
        } else {
            return false;
        }
    },
    _mouseUp: function(c) {
        c = SuperMap.Web.Utility.getEvent(c);
        SuperMap.Web.Utility.cancelBubble(c);
        if (!!this._interId) {
            window.clearInterval(this._interId);
        }
        this._map._action = this._lastAction;
        this._ib_e = this._getEventPosition(c);
        var b = (this._ib_e.x - this._ib_s.x) * this._overViewMap.get_resolution();
        var d = (this._ib_e.y - this._ib_s.y) * this._overViewMap.get_resolution();
        var a = new SuperMap.Web.Core.Point2D(this._overViewMap._viewBounds.center().x + b, this._overViewMap._viewBounds.center().y - d);
        this._map.panTo(a);
        this._indexAction = false;
        this._overViewMap._kbInput.focus();
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            document.detachEvent("onmousemove", this._mouseMoveDelegate);
            document.detachEvent("onmouseup", this._mouseUpDelegate);
        } else {
            document.removeEventListener("mousemove", this._mouseMoveDelegate, true);
            document.removeEventListener("mouseup", this._mouseUpDelegate, true);
        }
        return false;
    },
    _getEventPosition: function(a) { return new SuperMap.Web.Core.Point(SuperMap.Web.Utility.getMouseX(a) - this._x, SuperMap.Web.Utility.getMouseY(a) - this._y); },
    _getPosition: function() {
        this._x = SuperMap.Web.Utility.getElementX(this._overViewMap._workLayer);
        this._y = SuperMap.Web.Utility.getElementY(this._overViewMap._workLayer);
        if (this._overViewContainer.style.borderLeftWidth) {
            this._x += parseInt(this._overViewContainer.style.borderLeftWidth);
        }
        if (this._overViewContainer.style.borderTopWidth) {
            this._y += parseInt(this._overViewContainer.style.borderTopWidth);
        }
    },
    _zoomToResolution: function(c, a) {
        c = this._rectifyResolution(c);
        if (typeof(a) == "undefined" || a.isEmpty()) {
            var g = this._overViewMap.get_viewBounds().center().x - c * this._size.width / 2;
            var d = this._overViewMap.get_viewBounds().center().x + c * this._size.width / 2;
            var f = this._overViewMap.get_viewBounds().center().y + c * this._size.height / 2;
            var b = this._overViewMap.get_viewBounds().center().y - c * this._size.height / 2;
        } else {
            var g = a.x - c * this._size.width / 2;
            var d = a.x + c * this._size.width / 2;
            var f = a.y + c * this._size.height / 2;
            var b = a.y - c * this._size.height / 2;
        }
        var e = new SuperMap.Web.Core.Rectangle2D(g, b, d, f);
        this._overViewMap._isZooming = true;
        this._overViewMap.set_viewBounds(e);
        this._overViewMap._isZooming = false;
    },
    _rectifyResolution: function(a) {
        if (this._resolutions != null) {
            for (var b = 0; b < this._resolutions.length - 1; b++) {
                if (a <= this._resolutions[b] && a >= this._resolutions[b + 1]) {
                    a = (this._resolutions[b] - a) < (a - this._resolutions[b + 1]) ? this._resolutions[b] : this._resolutions[b + 1];
                    return a;
                } else {
                    if (a < this._resolutions[this._resolutions.length - 1]) {
                        a = this._resolutions[this._resolutions.length - 1];
                        return a;
                    } else {
                        if (a > this._resolutions[0]) {
                            a = this._resolutions[0];
                            return a;
                        }
                    }
                }
            }
        }
        return a;
    },
    _initIndexBox: function() {
        var b = this._map.get_viewBounds();
        var d = this._overViewMap.mapToScreen(new SuperMap.Web.Core.Point2D(b.leftBottom.x, b.rightTop.y));
        var c = b.width() / this._overViewMap.get_resolution();
        var a = b.height() / this._overViewMap.get_resolution();
        if (!this._indexBox) {
            this._indexBox = document.createElement("div");
            this._indexBox.style.position = "absolute";
            this._indexBox.style.zIndex = "10";
            this._indexBox.style.border = "3px solid #0000d5";
            this._indexBox.style.backgroundColor = "#54A3F4";
            this._indexBox.style.opacity = 0.3;
            this._indexBox.style.filter = "alpha(opacity=30)";
            this._overViewMap._workLayer.appendChild(this._indexBox);
            $addHandler(this._indexBox, "mousedown", this._mouseDownDelegate);
        }
        if (this._indexBox.style.display === "none") {
            this._indexBox.style.display = "block";
        }
        this._indexBox.style.left = d.x + "px";
        this._indexBox.style.top = d.y + "px";
        this._indexBox.style.width = c + "px";
        this._indexBox.style.height = a + "px";
    },
    _refershIndexBox: function() {
        if (this._indexBox != null) {
            var b = this._map.get_viewBounds();
            var d = this._overViewMap.mapToScreen(new SuperMap.Web.Core.Point2D(b.leftBottom.x, b.rightTop.y));
            var c = b.width() / this._overViewMap.get_resolution();
            var a = b.height() / this._overViewMap.get_resolution();
            this._indexBox.style.left = d.x + "px";
            this._indexBox.style.top = d.y + "px";
            this._indexBox.style.width = c + "px";
            this._indexBox.style.height = a + "px";
        }
    }
};
SuperMap.Web.Controls.OverviewMap.registerClass("SuperMap.Web.Controls.OverviewMap", SuperMap.Web.Controls.ControlBase);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.ScaleBar = function(a) {
    SuperMap.Web.Controls.ScaleBar.initializeBase(this);
    a = this._extend(a);
    this._map = null;
    this._scaleBarStyle = a.scaleBarStyle;
    this._pos = a.pos;
    this._id = a.id;
    this._containerBase = null;
    this._container = null;
    this._kmLabel = null;
    this._mileLabel = null;
    this._kmValue = null;
    this._mileValue = null;
    this._scaleBody2 = null;
    this._isInitialized = false;
    this._PIXELS_PER_METER = 3779.53;
    this._intervalNum = null;
    this._width = 200;
    this._height = 30;
    this._showing = true;
};
SuperMap.Web.Controls.ScaleBar.prototype = {
    set_scaleBarStyle: function(a) { this._scaleBarStyle = this._extendStyle(a); },
    setPosition: function(a) {
        this._pos = a;
        this._containerBase.style.left = a.x + "px";
        this._containerBase.style.top = a.y + "px";
    },
    show: function() {
        this._containerBase.style.display = "block";
        this._showing = true;
    },
    hide: function() {
        this._containerBase.style.display = "none";
        this._showing = false;
    },
    _extend: function(a) {
        if (!a) {
            a = { };
        }
        if (!a.pos) {
            a.pos = new SuperMap.Web.Core.Point(10, 10);
        }
        if (!a.id) {
            throw new Error("ScaleBar's id is null!");
        }
        if (!a.scaleBarStyle) {
            a.scaleBarStyle = { };
            a.scaleBarStyle._weight = 2;
            a.scaleBarStyle._fontFamily = "verdana";
            a.scaleBarStyle.color = "black";
            a.scaleBarStyle.fontSize = 2;
            a.scaleBarStyle.mode = 1;
        } else {
            a.scaleBarStyle._weight = 2;
            a.scaleBarStyle._fontFamily = "verdana";
        }
        return a;
    },
    _extendStyle: function(b) {
        var a = { };
        a._weight = 2;
        a._fontFamily = "verdana";
        if (b.color) {
            a.color = b.color;
        }
        if (b.fontSize) {
            a.fontSize = b.fontSize;
        }
        if (b.mode) {
            a.mode = b.mode;
        }
        return a;
    },
    initialize: function(a) {
        this._map = a;
        this._initialize();
    },
    dispose: function() {
        var a = this._map && this._map._workLayer;
        if (a) {
            a.removeChild(this._containerBase);
        }
    },
    _initialize: function() {
        this._containerBase = document.createElement("div");
        this._containerBase.id = this._id;
        this._containerBase.style.position = "absolute";
        this._containerBase.style.left = this._pos.x + "px";
        this._containerBase.style.width = 150 + "px";
        this._containerBase.style.bottom = this._pos.y + "px";
        this._containerBase.style.height = 30 + "px";
        this._containerBase.style.zIndex = 100;
        if (this._map._baseLayerInitialized == false) {
            this._baseLayerIniDelegate = Function.createDelegate(this, this._initializeScaleBar);
            this._map.add_baseLayerInitialized(this._baseLayerIniDelegate);
        } else {
            this._initializeScaleBar();
        }
        var a = Function.createDelegate(this, this._updateScaleBar);
        this._map.add_viewBoundsChanged(a);
    },
    _initializeScaleBar: function() {
        var a = this._map.get_scale();
        if (!a) {
            return;
        }
        clearInterval(this._intervalNum);
        this._intervalNum = null;
        this._isInitialized = true;
        this._map._workLayer.appendChild(this._containerBase);
        this._height = this._containerBase.clientHeight;
        if (this._scaleBarStyle.mode == 1) {
            this._width = this._containerBase.clientWidth;
            this._installScaleBar1();
        } else {
            if (this._scaleBarStyle.mode == 2) {
                this._width = this._containerBase.clientWidth - 60;
                this._installScaleBar2();
            }
        }
        this._updateScaleBar();
    },
    _installScaleBar1: function() {
        var a = this._height / 2;
        var b = (this._height / 2) + "px";
        var i = 0;
        var c = (a + 4) + "px";
        var d = (a + 4) + "px";
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            a = a - this._scaleBarStyle._weight / 2;
            c = (this._height / 2 + 6) + "px";
            d = (this._height / 2 + 4) + "px";
            i = this._scaleBarStyle._weight / 2;
        }
        var f = a;
        i = i + "px";
        a = a + "px";
        var g = this._height + "px";
        var e = "solid " + (this._scaleBarStyle._weight / 2) + "px " + this._scaleBarStyle.color;
        this._container = this._newDomObj("div", null, "absolute", "0px", "0px", "30px", g, 1, null, null, null);
        var h = this._newDomObj("div", "scaleBody1", "absolute", "0px", "0px", "0px", g, 1, null, e, null);
        this._scaleBody2 = this._newDomObj("div", "scaleBody2", "absolute", a, "0px", "100px", "0px", 1, null, e, null);
        this._mileLabel = this._newDomObj("div", "mileLable", "absolute", f, "50px", "0px", b, 1, null, e, null);
        this._kmLabel = this._newDomObj("div", "kmLabel", "absolute", i, "100px", "0px", b, 1, null, e, null);
        this._kmValue = this._newDomObj("div", "kmValue", "absolute", null, "2px", "150px", b, 1, null, null, d);
        this._mileValue = this._newDomObj("div", "kmValue", "absolute", c, "2px", "150px", b, 1, null, null, null);
        this._container.appendChild(h);
        this._container.appendChild(this._scaleBody2);
        this._container.appendChild(this._kmLabel);
        this._container.appendChild(this._mileLabel);
        this._container.appendChild(this._kmValue);
        this._container.appendChild(this._mileValue);
        this._containerBase.appendChild(this._container);
        this._scaleBody2.style.overflow = "hidden";
        this._mileLabel.style.fontSize = 0;
        this._kmLabel.style.fontSize = 0;
        this._scaleBody2.style.lineHeight = "0px";
        h.style.lineHeight = "0px";
        this._kmValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;bottom:0px;'>****公里</font>";
        this._mileValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;top:0px;'>****英里</font>";
    },
    _installScaleBar2: function() {
        var e = this._height / 2;
        var c = (this._height / 2 - 5) + "px";
        var f = 0;
        var b = (e + 4) + "px";
        var d = (e + 4) + "px";
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            e = e - this._scaleBarStyle._weight / 2;
            b = (this._height / 2 + 6) + "px";
            d = (this._height / 2 + 4) + "px";
            f = -1 * this._scaleBarStyle._weight / 2;
        }
        f = f + "px";
        e = e + "px";
        var a = "solid " + (this._scaleBarStyle._weight / 2) + "px " + this._scaleBarStyle.color;
        this._container = this._newDomObj("div", null, "absolute", "0px", "0px", "30px", this._height, 1, null, null, null);
        this._mileLabel = this._newDomObj("div", "mileLable", "absolute", null, "0px", "50px", c, 1, null, null, "0px");
        this._kmLabel = this._newDomObj("div", "kmLabel", "absolute", "0px", "0px", "100px", c, 1, null, null, null);
        this._kmValue = this._newDomObj("div", "kmValue", "absolute", "0px", "120px", "150px", c, 1, null, null, null);
        this._mileValue = this._newDomObj("div", "kmValue", "absolute", null, "70px", "150px", c, 1, null, null, "0px");
        this._container.appendChild(this._kmLabel);
        this._container.appendChild(this._mileLabel);
        this._container.appendChild(this._kmValue);
        this._container.appendChild(this._mileValue);
        this._containerBase.appendChild(this._container);
        this._kmLabel.style.background = this._scaleBarStyle.color;
        this._mileLabel.style.background = this._scaleBarStyle.color;
        this._mileLabel.style.overflow = "hidden";
        this._kmLabel.style.overflow = "hidden";
        this._kmLabel.style.lineHeight = "0px";
        this._mileLabel.style.lineHeight = "0px";
        this._kmValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;bottom:0px;'>****公里</font>";
        this._mileValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;top:0px;'>****英里</font>";
    },
    _getMileLength: function(c) {
        var d = null;
        var a = null;
        var b = 0;
        a = 1 / c / this._PIXELS_PER_METER;
        if (a * this._width < 800) {
            a = a * 39.37 / 12;
            d = this._calcScale(a, this._width);
            b = Math.round(d / a);
            this._mileValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;top:0px;font-family:" + this._scaleBarStyle._fontFamily + ";'>" + Math.floor(d).toString() + " 英尺</font>";
        } else {
            a = a * 39.37 / (12 * 5280);
            d = this._calcScale(a, this._width);
            b = Math.round(d / a);
            this._mileValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;top:0px;font-family:" + this._scaleBarStyle._fontFamily + ";'>" + Math.max(Math.floor(d), 0.5).toString() + " 英里</font>";
        }
        return b;
    },
    _getKiloLength: function(c) {
        var d = null;
        var a = null;
        var b = 0;
        a = 1 / c / this._PIXELS_PER_METER;
        if (a * this._width < 800) {
            d = this._calcScale(a, this._width);
            b = Math.round(d / a);
            this._kmValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;bottom:0px;font-family:" + this._scaleBarStyle._fontFamily + ";'>" + Math.floor(d).toString() + " 米</font>";
        } else {
            d = this._calcScale(a / 1000, this._width);
            b = Math.round(d * 1000 / a);
            this._kmValue.innerHTML = "<font size='" + this._scaleBarStyle.fontSize + "' color='" + this._scaleBarStyle.color + "' style='position:absolute;bottom:0px;font-family:" + this._scaleBarStyle._fontFamily + ";'>" + Math.max(Math.floor(d), 0.5).toString() + " 公里</font>";
        }
        return b;
    },
    _calcScale: function(b, c) {
        var h = b * c;
        var e = Math.log(h) / Math.log(10);
        var i = Math.floor(e);
        var g = Math.pow(10, i);
        var d = h / g;
        var a = 0.1;
        if (d < 0.2) {
            a = 0.1;
        } else {
            if (d < 0.3) {
                a = 0.2;
            } else {
                if (d < 0.4) {
                    a = 0.3;
                } else {
                    if (d < 0.5) {
                        a = 0.4;
                    } else {
                        if (d < 1) {
                            a = 0.5;
                        } else {
                            if (d < 2) {
                                a = 1;
                            } else {
                                if (d < 3) {
                                    a = 2;
                                } else {
                                    if (d < 4) {
                                        a = 3;
                                    } else {
                                        if (d < 5) {
                                            a = 4;
                                        } else {
                                            if (d < 10) {
                                                a = 5;
                                            } else {
                                                a = 10;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        var f = g * a;
        return f;
    },
    _updateScaleBar: function() {
        if (this._isInitialized == false) {
            return;
        }
        var d = this._map.get_scale();
        var c = this._getKiloLength(d);
        var a = this._getMileLength(d);
        if (this._scaleBarStyle.mode == 1) {
            this._mileLabel.style.left = a + "px";
            this._kmLabel.style.left = c + "px";
            var b = (c > a) ? c : a;
            this._scaleBody2.style.width = b + "px";
        } else {
            if (this._scaleBarStyle.mode == 2) {
                this._mileLabel.style.width = a + "px";
                this._kmLabel.style.width = c + "px";
                this._kmValue.style.left = (c + 20) + "px";
                this._mileValue.style.left = (a + 20) + "px";
            }
        }
    },
    _newDomObj: function(i, e, a, j, l, k, c, f, b, h, d) {
        var g = document.createElement(i);
        if (e) {
            g.id = e;
        }
        g.style.position = a;
        if (j != null) {
            g.style.top = j;
        }
        g.style.left = l;
        g.style.width = k;
        g.style.height = c;
        g.style.zIndex = f;
        if (b) {
            g.src = b;
        }
        if (h) {
            g.style.border = h;
        }
        if (d != null) {
            g.style.bottom = d;
        }
        return g;
    },
    _pxToNum: function(c) {
        var b = c;
        var a = Number(b.substring(0, (b.length - 2)));
        return a;
    }
};
SuperMap.Web.Controls.ScaleBar.registerClass("SuperMap.Web.Controls.ScaleBar", SuperMap.Web.Controls.ControlBase);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.ZoomSlider = function(a) {
    SuperMap.Web.Controls.ZoomSlider.initializeBase(this);
    this._showing = true;
    a = this._extend(a);
    this._map = null;
    this._pos = a.pos;
    this._id = a.id;
    this._sliderPlusHeight = "27px";
    this._sliderPlusWidth = "35px";
    this._sliderPlusImgUrl = a.imageSrc.sliderPlusImageSrc;
    this._sliderMinusHeight = "23px";
    this._sliderMinusWidth = "35px";
    this._sliderMinusImgUrl = a.imageSrc.sliderMinusImageSrc;
    this._totalLevelWidth = "35px";
    this._totalLevelHeight = "27px";
    this._levelImg = a.imageSrc.levelImageSrc;
    this._levelImgHeight = "10px";
    this._levelImgWidth = "35px";
    this._sliderThumbHeight = "10px";
    this._sliderThumbWidth = "35px";
    this._sliderThumbImgUrl = a.imageSrc.sliderThumbImageSrc;
    this.direction = "up";
    this._levels = 1;
    this._totalLevelLength = "1px";
    this._sliderThumbPosition = 0;
    this._moveThumbStart = false;
    this._leveDistance = 0;
    this._resolutions = new Array();
    this._totalDistance = 0;
    this._isInitialized = false;
    this._sliderMinusClickDelegate = Function.createDelegate(this, this._clickSliderMinus);
    this._sliderPlusClickDelegate = Function.createDelegate(this, this._clickSliderPlus);
    this._sliderBarDivMouseDownDelegate = Function.createDelegate(this, this._thumbMouseDown);
    this._sliderBarDivMouseMoveDelegate = Function.createDelegate(this, this._thumbMouseMove);
    this._sliderBarDivMouseUpDelegate = Function.createDelegate(this, this._thumbMouseUp);
    this._intervalNum = null;
};
SuperMap.Web.Controls.ZoomSlider.prototype = {
    setImgLocation: function(a) {
        this._sliderPlusImgUrl = a.sliderPlusImageSrc;
        this._sliderMinusImgUrl = a.sliderMinusImageSrc;
        this._levelImg = a.levelImageSrc;
        this._sliderThumbImgUrl = a.sliderThumbImageSrc;
        if (this._isInitialized == true) {
            this._initializeControl();
        }
    },
    setPosition: function(a) {
        this._pos = a;
        this._containerBase.style.right = a.x + "px";
        this._containerBase.style.top = a.y + "px";
        if (this._isInitialized == true) {
            this._initializeControl();
        }
    },
    show: function() {
        this._containerBase.style.display = "block";
        this._showing = true;
    },
    hide: function() {
        this._containerBase.style.display = "none";
        this._showing = false;
    },
    _extend: function(a) {
        if (!a) {
            a = { };
        }
        if (!a.imageSrc) {
            a.imageSrc = { };
            a.imageSrc.sliderPlusImageSrc = "scripts/libs/supermap/images/controls/slider_plus.png";
            a.imageSrc.sliderMinusImageSrc = "scripts/libs/supermap/images/controls/slider_minus.png";
            a.imageSrc.levelImageSrc = "scripts/libs/supermap/images/controls/slider_level.png";
            a.imageSrc.sliderThumbImageSrc = "scripts/libs/supermap/images/controls/slider_thumb.png";
        }
        if (!a.pos) {
            a.pos = new SuperMap.Web.Core.Point(0, 100);
        }
        if (!a.id) {
            throw new Error("ZoomSlider's id is null!");
        }
        return a;
    },
    initialize: function(a) {
        this._map = a;
        this._createTemplete();
        this._putOn(this._map._workLayer);
    },
    dispose: function() {
        var a = this._map && this._map._workLayer;
        if (a) {
            a.removeChild(this._containerBase);
        }
    },
    _putOn: function(a) { a.appendChild(this._containerBase); },
    _createTemplete: function() {
        this._containerBase = document.createElement("div");
        this._containerBase.id = this._id;
        this._containerBase.style.position = "absolute";
        this._containerBase.style.height = "100px";
        this._containerBase.style.width = "75px";
        this._containerBase.style.zIndex = 99;
        this._containerBase.style.cursor = "pointer";
        this._containerBase.style.right = this._pos.x + "px";
        this._containerBase.style.top = this._pos.y + "px";
        this._container = null;
        if (this._map._innerResolutions && this._map._innerResolutions.length > 0) {
            this._initializeControl();
        } else {
            this._initSliderDelegate = Function.createDelegate(this, this._initializeControl);
            this._map._add_resolutionsPrepared(this._initSliderDelegate);
        }
    },
    _getImgSize: function(a) {
        var c = new Image();
        c.src = a;
        this._containerBase.appendChild(c);
        alert(c.offsetWidth);
        var b = new Object();
        b.width = c.offsetWidth;
        b.height = c.offsetHeight;
        this._containerBase.removeChild(c);
        return b;
    },
    _initializeControl: function() {
        if (this._isInitialized == false) {
            this._map._remove_resolutionsPrepared(this._initSliderDelegate);
            this._isInitialized = true;
        } else {
            this._dispose();
        }
        var a = this._getResolutions();
        if (!a) {
            if (SuperMap.Web.Utility.isDebug) {
                console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.UI.Resources", "SliderBarControl_initializeControl_resolutionsNull"));
            }
            return;
        }
        if (!this._map) {
            if (SuperMap.Web.Utility.isDebug) {
                console.error(SuperMap.Web.Resources.Resource.getMessage("SuperMap.Web.UI.Resources", "SliderBarControl_initializeControl_mapControlNull"));
            }
            return;
        }
        this._setLevels();
        if (this._isOversize()) {
            this._installSimpleSliderBar();
            $addHandler(this._sliderMinus, "click", this._sliderMinusClickDelegate);
            $addHandler(this._sliderPlus, "click", this._sliderPlusClickDelegate);
        } else {
            this._installSliderBar();
            this._bindEvent();
            if (this.direction == "up") {
                this._totalDistance = this._pxToNum(this._totalLevelLength) - this._pxToNum(this._sliderThumbHeight);
            } else {
                if (this.direction == "right") {
                    this._totalDistance = this._pxToNum(this._totalLevelLength) - this._pxToNum(this._sliderThumbWidth);
                }
            }
            this._leveDistance = this._totalDistance / (this._resolutions.length - 1);
            this._setMarkPositionDelegate = Function.createDelegate(this, this._setMarkPosition);
            this._map.add_viewBoundsChanged(this._setMarkPositionDelegate);
            this._setMarkPosition();
        }
        this._containerBase.appendChild(this._container);
        this._containerBase.style.MozUserSelect = "none";
        this._containerBase.onselectstart = function() { return false; };
    },
    _isOversize: function() {
        var b = this._map.get_height();
        var a = this._pxToNum(this._sliderPlusHeight) + this._pxToNum(this._sliderMinusHeight) + this._pxToNum(this._totalLevelLength);
        if ((a + this._pxToNum(this._containerBase.style.top) + 50) > b) {
            return true;
        } else {
            return false;
        }
    },
    _dispose: function() {
        $clearHandlers(this._sliderMinus);
        $clearHandlers(this._sliderPlus);
        if (this._sliderBarDiv) {
            $clearHandlers(this._sliderBarDiv);
            this._container.removeChild(this._sliderBarDiv);
            this._sliderBarDiv = null;
        }
        if (this._sliderThumb && this._thumbContainerDiv) {
            this._thumbContainerDiv.removeChild(this._sliderThumb);
            this._sliderThumb = null;
            this._container.removeChild(this._thumbContainerDiv);
            this._thumbContainerDiv = null;
        }
        this._container.removeChild(this._sliderPlus);
        this._sliderPlus = null;
        this._container.removeChild(this._sliderMinus);
        this._sliderMinus = null;
        this._containerBase.removeChild(this._container);
        this._container = null;
        if (this._setMarkPositionDelegate) {
            this._map.remove_viewBoundsChanged(this._setMarkPositionDelegate);
        }
    },
    _installSliderBar: function() {
        this._container = document.createElement("div");
        this._container.style.position = "absolute";
        if (this.direction == "up") {
            var g = (this._pxToNum(this._sliderPlusWidth) >= this._pxToNum(this._sliderMinusWidth)) ? this._pxToNum(this._sliderPlusWidth) : this._pxToNum(this._sliderMinusWidth);
            g = (g >= this._pxToNum(this._totalLevelWidth)) ? g : this._pxToNum(this._totalLevelWidth);
            this._container.style.width = g;
            this._container.style.height = this._pxToNum(this._sliderPlusHeight) + this._pxToNum(this._sliderMinusHeight) + this._pxToNum(this._totalLevelLength);
            var e = g / 2 - this._pxToNum(this._sliderPlusWidth) / 2;
            this._sliderPlus = this._newDomObj("div", "zoom_plus", "absolute", "0px", e, this._sliderPlusWidth, this._sliderPlusHeight, 9, this._sliderPlusImgUrl, "solid red 0px", null, "放大");
            var b = g / 2 - this._pxToNum(this._totalLevelWidth) / 2;
            this._thumbContainerDiv = this._newDomObj("div", "thumbContainerDiv", "absolute", this._sliderPlusHeight, b, this._totalLevelWidth, this._totalLevelLength, 10, this._levelImg, "solid red 0px");
            var j = (this._pxToNum(this._totalLevelWidth) - this._pxToNum(this._sliderThumbWidth)) / 2;
            this._sliderThumb = this._newDomObj("div", "sliderMark", "absolute", null, j, this._sliderThumbWidth, this._sliderThumbHeight, 8, this._sliderThumbImgUrl, "solid red 0px", "0px", null);
            this._sliderThumb.style.fontSize = "0px";
            var d = (this._pxToNum(this._sliderPlusHeight) + this._pxToNum(this._totalLevelLength)) + "px";
            var f = (g - this._pxToNum(this._sliderMinusWidth)) / 2;
            this._sliderMinus = this._newDomObj("div", "zoom_minus", "absolute", d, f, this._sliderMinusWidth, this._sliderMinusHeight, 9, this._sliderMinusImgUrl, "solid red 0px", null, "缩小");
            this._sliderBarDiv = this._newDomObj("div", "sliderBarDiv", "absolute", this._sliderPlusHeight, b, this._totalLevelWidth, this._totalLevelLength, 12, null, "solid red 0px", null);
        } else {
            if (this.direction == "right") {
                var c = (this._pxToNum(this._sliderPlusHeight) >= this._pxToNum(this._sliderMinusHeight)) ? this._pxToNum(this._sliderPlusHeight) : this._pxToNum(this._sliderMinusHeight);
                c = (c >= this._pxToNum(this._totalLevelHeight)) ? c : this._pxToNum(this._totalLevelHeight);
                this._container.style.height = c;
                this._container.style.width = this._pxToNum(this._sliderPlusWidth) + this._pxToNum(this._sliderMinusWidth) + this._pxToNum(this._totalLevelLength);
                var a = c / 2 - this._pxToNum(this._sliderPlusHeight) / 2;
                this._sliderPlus = this._newDomObj("div", "zoom_plus", "absolute", a, "0px", this._sliderPlusWidth, this._sliderPlusHeight, 9, this._sliderPlusImgUrl, "solid red 0px", null, "放大");
                var i = c / 2 - this._pxToNum(this._totalLevelHeight) / 2;
                this._thumbContainerDiv = this._newDomObj("div", "thumbContainerDiv", "absolute", i, this._sliderPlusWidth, this._totalLevelLength, this._totalLevelHeight, 10, null, "solid red 0px");
                var h = (this._pxToNum(this._totalLevelHeight) - this._pxToNum(this._sliderThumbHeight)) / 2;
                this._sliderThumb = this._newDomObj("div", "sliderMark", "absolute", h, "0px", this._sliderThumbWidth, this._sliderThumbHeight, 8, this._sliderThumbImgUrl, "solid red 0px", null);
                this._sliderThumb.style.fontSize = "0px";
                var f = this._pxToNum(this._sliderPlusWidth) + this._pxToNum(this._totalLevelLength);
                var d = (c - this._pxToNum(this._sliderMinusHeight)) / 2;
                this._sliderMinus = this._newDomObj("div", "zoom_minus", "absolute", d, f, this._sliderMinusWidth, this._sliderMinusHeight, 9, this._sliderMinusImgUrl, "solid red 0px", null, "缩小");
                this._sliderBarDiv = this._newDomObj("div", "sliderBarDiv", "absolute", i, this._sliderPlusWidth, this._totalLevelLength, this._totalLevelHeight, 12, null, "solid red 0px");
            }
        }
        this._container.style.zIndex = 10;
        this._container.style.border = "solid 0px red";
        this._container.appendChild(this._sliderPlus);
        this._container.appendChild(this._thumbContainerDiv);
        this._thumbContainerDiv.appendChild(this._sliderThumb);
        this._container.appendChild(this._sliderMinus);
        this._container.appendChild(this._sliderBarDiv);
        this._sliderBarDiv.style.background = "url(images/transparent.gif)";
        this._sliderBarDiv.style.MozUserSelect = "none";
        this._disableEvents();
    },
    _installSimpleSliderBar: function() {
        this._container = document.createElement("div");
        this._container.style.position = "absolute";
        if (this.direction == "up") {
            var b = (this._pxToNum(this._sliderPlusWidth) >= this._pxToNum(this._sliderMinusWidth)) ? this._pxToNum(this._sliderPlusWidth) : this._pxToNum(this._sliderMinusWidth);
            this._container.style.width = b;
            this._container.style.height = this._pxToNum(this._sliderPlusHeight) + this._pxToNum(this._sliderMinusHeight);
            var d = b / 2 - this._pxToNum(this._sliderPlusWidth) / 2;
            this._sliderPlus = this._newDomObj("div", "zoom_plus", "absolute", "0px", d, this._sliderPlusWidth, this._sliderPlusHeight, 9, this._sliderPlusImgUrl, "solid red 0px", null, "放大");
            var a = this._pxToNum(this._sliderPlusHeight);
            var c = (b - this._pxToNum(this._sliderMinusWidth)) / 2;
            this._sliderMinus = this._newDomObj("div", "zoom_minus", "absolute", a, c, this._sliderMinusWidth, this._sliderMinusHeight, 9, this._sliderMinusImgUrl, "solid red 0px", null, "缩小");
        } else {
            if (this.direction == "right") {
            }
        }
        this._container.style.zIndex = 10;
        this._container.style.border = "solid 0px red";
        this._container.appendChild(this._sliderPlus);
        this._container.appendChild(this._sliderMinus);
        this._sliderMinus.ondblclick = function(f) {
            f = SuperMap.Web.Utility.getEvent(f);
            SuperMap.Web.Utility.cancelBubble(f);
        };
        this._sliderPlus.ondblclick = function(f) {
            f = SuperMap.Web.Utility.getEvent(f);
            SuperMap.Web.Utility.cancelBubble(f);
        };
        this._sliderMinus.onmousedown = function(f) {
            f = SuperMap.Web.Utility.getEvent(f);
            SuperMap.Web.Utility.cancelBubble(f);
            return false;
        };
        this._sliderPlus.onmousedown = function(f) {
            f = SuperMap.Web.Utility.getEvent(f);
            SuperMap.Web.Utility.cancelBubble(f);
            return false;
        };
    },
    _disableEvents: function() {
        this._sliderMinus.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._sliderPlus.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._sliderThumb.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._thumbContainerDiv.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._container.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._containerBase.onmousedown = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
            return false;
        };
        this._sliderMinus.ondblclick = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
        this._sliderPlus.ondblclick = function(a) {
            a = SuperMap.Web.Utility.getEvent(a);
            SuperMap.Web.Utility.cancelBubble(a);
        };
    },
    _getResolutions: function() {
        this._resolutions = this._map.get_innerResolutions();
        if (this._resolutions.length > 0) {
            return true;
        } else {
            return false;
        }
    },
    _setLevels: function() {
        this._levels = this._resolutions.length;
        if (this.direction == "up") {
            this._totalLevelLength = this._levels * this._pxToNum(this._levelImgHeight) + "px";
        } else {
            if (this.direction == "right") {
                this._totalLevelLength = this._levels * this._pxToNum(this._levelImgWidth) + "px";
            }
        }
    },
    _setMarkPosition: function() {
        var b = this._map.get_resolution();
        for (var a = 0; a <= this._resolutions.length; a++) {
            if (this._resolutions[this._resolutions.length - 1] >= b) {
                this._sliderThumbPosition = a * this._leveDistance;
                this._moveThumb();
            } else {
                if (this._resolutions[a] >= b && b > this._resolutions[a + 1]) {
                    this._sliderThumbPosition = a * this._leveDistance;
                    this._moveThumb();
                }
            }
        }
    },
    _clickSliderPlus: function() {
        if (this._isOversize()) {
            this._zoom("up");
            return;
        }
        this._sliderThumbPosition += this._leveDistance;
        var a = this._sliderThumbPosition;
        this._moveThumb();
        if (a <= (this._totalDistance + 1)) {
            this._zoomToLevel();
        }
    },
    _clickSliderMinus: function() {
        if (this._isOversize()) {
            this._zoom("down");
            return;
        }
        this._sliderThumbPosition -= this._leveDistance;
        var a = this._sliderThumbPosition;
        this._moveThumb();
        if (a >= 0) {
            this._zoomToLevel();
        }
    },
    _thumbMouseDown: function(a) {
        this._moveThumbStart = true;
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        if (this.direction == "up") {
            this._sliderThumbPosition = this._pxToNum(this._totalLevelLength) - a.offsetY - this._pxToNum(this._sliderThumbHeight) / 2;
        } else {
            if (this.direction == "right") {
                this._sliderThumbPosition = a.offsetX - this._pxToNum(this._sliderThumbWidth) / 2;
            }
        }
        this._moveThumb();
        this._containerBase.style.cursor = "url(scripts/libs/supermap/images/cur/PanDown.cur),auto";
        return false;
    },
    _thumbMouseMove: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        if (this._moveThumbStart == true) {
            if (this.direction == "up") {
                this._sliderThumbPosition = this._pxToNum(this._totalLevelLength) - a.offsetY - this._pxToNum(this._sliderThumbHeight) / 2;
            } else {
                if (this.direction == "right") {
                    this._sliderThumbPosition = a.offsetX - this._pxToNum(this._sliderThumbWidth) / 2;
                }
            }
            this._moveThumb();
        }
        return false;
    },
    _thumbMouseUp: function(a) {
        a = SuperMap.Web.Utility.getEvent(a);
        SuperMap.Web.Utility.cancelBubble(a);
        if (this._moveThumbStart == true) {
            this._moveThumbStart = false;
            this._zoomToLevel();
        }
        this._containerBase.style.cursor = "pointer";
        return false;
    },
    _moveThumb: function() {
        if (this._sliderThumbPosition < 0) {
            this._sliderThumbPosition = 0;
        }
        if (this._sliderThumbPosition > this._totalDistance) {
            this._sliderThumbPosition = this._totalDistance;
        }
        if (this.direction == "up") {
            this._sliderThumb.style.bottom = this._sliderThumbPosition;
        } else {
            if (this.direction == "right") {
                this._sliderThumb.style.left = this._sliderThumbPosition;
            }
        }
    },
    _pxToNum: function(c) {
        var b = c;
        var a = Number(b.substring(0, (b.length - 2)));
        return a;
    },
    _zoomToLevel: function() {
        if (this.direction == "up") {
            var a = Math.round(this._pxToNum(this._sliderThumb.style.bottom) / this._leveDistance);
        } else {
            if (this.direction == "right") {
                var a = Math.round(this._pxToNum(this._sliderThumb.style.left) / this._leveDistance);
            }
        }
        this._map.zoomToLevel(a);
    },
    _zoom: function(a) {
        for (var b in this._resolutions) {
            if (this._map.get_resolution() == this._resolutions[b]) {
                var c = b;
                break;
            }
        }
        if (a == "up") {
            c++;
        } else {
            if (a == "down") {
                c--;
            }
        }
        this._map.zoomToLevel(c);
    },
    _newDomObj: function(k, e, a, l, j, m, c, f, b, i, d, h) {
        var g = document.createElement(k);
        g.id = e;
        g.style.position = a;
        if (l != null) {
            g.style.top = l;
        }
        g.style.right = j;
        g.style.width = m;
        g.style.height = c;
        g.style.zIndex = f;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            if (Sys.Browser.version == 6) {
                g.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + b + "');";
            } else {
                g.style.backgroundImage = "url(" + b + ")";
            }
        } else {
            g.style.backgroundImage = "url(" + b + ")";
        }
        g.style.border = i;
        if (d != null) {
            g.style.bottom = d;
        }
        if (h) {
            g.title = h;
        }
        return g;
    },
    _bindEvent: function() {
        $addHandler(this._sliderMinus, "click", this._sliderMinusClickDelegate);
        $addHandler(this._sliderPlus, "click", this._sliderPlusClickDelegate);
        $addHandler(this._sliderBarDiv, "mousedown", this._sliderBarDivMouseDownDelegate);
        $addHandler(this._sliderBarDiv, "mousemove", this._sliderBarDivMouseMoveDelegate);
        $addHandler(this._sliderBarDiv, "mouseup", this._sliderBarDivMouseUpDelegate);
    }
};
SuperMap.Web.Controls.ZoomSlider.registerClass("SuperMap.Web.Controls.ZoomSlider", SuperMap.Web.Controls.ControlBase);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.Compass = function(a) {
    SuperMap.Web.Controls.Compass.initializeBase(this);
    a = this._extend(a);
    this._map = null;
    this._imageSrc = a.imageSrc;
    this._pos = a.pos;
    this._id = a.id;
    this._createTemplete();
    this._showing = true;
    this._panMelodyStart = false;
    this._panNoteNum = 0;
};
SuperMap.Web.Controls.Compass.prototype = {
    initialize: function(a) {
        this._map = a;
        this._putOn(this._map._workLayer);
    },
    setImgLocation: function(a) {
        this._imageSrc = a;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            if (Sys.Browser.version == 6) {
                this._bgImg.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src='" + a + "');";
            } else {
                this._bgImg.style.backgroundImage = "url(" + a + ")";
            }
        } else {
            this._bgImg.style.backgroundImage = "url(" + a + ")";
        }
    },
    setPosition: function(a) {
        this._pos = a;
        this._container.style.right = a.x + "px";
        this._container.style.top = a.y + "px";
    },
    show: function() {
        this._container.style.display = "block";
        this._showing = true;
    },
    hide: function() {
        this._container.style.display = "none";
        this._showing = false;
    },
    _extend: function(a) {
        if (!a) {
            a = { };
        }
        if (!a.imageSrc) {
            a.imageSrc = "scripts/libs/supermap/images/controls/compass.png";
        }
        if (!a.pos) {
            a.pos = new SuperMap.Web.Core.Point(0, 0);
        }
        if (!a.id) {
            throw new Error("Compass's id is null!");
        }
        return a;
    },
    _putOn: function(a) { a.appendChild(this._container); },
    dispose: function() {
        var a = this._map && this._map._workLayer;
        if (a) {
            a.removeChild(this._container);
        }
    },
    _createTemplete: function() {
        this._container = document.createElement("div");
        this._container.id = this._id;
        this._container.style.position = "absolute";
        this._container.style.right = this._pos.x + "px";
        this._container.style.top = this._pos.y + "px";
        this._container.style.zIndex = 100;
        this._container.ondblclick = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
            return false;
        };
        if (Sys.Browser.name != "Microsoft Internet Explorer") {
            this._container.onselectstart = function() { return false; };
        }
        var e = document.createElement("div");
        e.style.position = "absolute";
        e.style.right = "10px";
        e.style.top = "10px";
        e.style.width = "99px";
        e.style.height = "99px";
        e.onmousedown = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
            return false;
        };
        this._container.appendChild(e);
        var c = document.createElement("div");
        c.style.position = "absolute";
        c.style.right = "2px";
        c.style.top = "2px";
        c.style.width = "93px";
        c.style.height = "93px";
        c.style.overflow = "hidden";
        e.appendChild(c);
        this._bgImg = document.createElement("div");
        this._bgImg.style.position = "absolute";
        this._bgImg.style.right = "0px";
        this._bgImg.style.top = "0px";
        this._bgImg.style.width = "93px";
        this._bgImg.style.height = "93px";
        this._bgImg.style.border = "0px none";
        this._bgImg.style.padding = "0px";
        this._bgImg.style.margin = "0px";
        this._bgImg.style.zIndex = 1;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            if (Sys.Browser.version == 6) {
                this._bgImg.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src='" + this._imageSrc + "');";
            } else {
                this._bgImg.style.backgroundImage = "url(" + this._imageSrc + ")";
            }
        } else {
            this._bgImg.style.backgroundImage = "url(" + this._imageSrc + ")";
        }
        this._bgImg.onmousedown = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
            return false;
        };
        this._bgImg.onmouseup = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
        };
        this._bgImg.onmousemove = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
        };
        this._bgImg.onclick = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
        };
        this._bgImg.ondblclick = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
        };
        this._bgImg.onmousewheel = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
        };
        if (Sys.Browser.name != "Microsoft Internet Explorer") {
            this._bgImg.onselectstart = function() { return false; };
        }
        c.appendChild(this._bgImg);
        var b = document.createElement("div");
        b.style.position = "absolute";
        b.style.right = "10px";
        b.style.top = "10px";
        b.style.width = "99px";
        b.style.height = "99px";
        b.style.zIndex = 2;
        if (Sys.Browser.name == "Microsoft Internet Explorer") {
            b.style.filter = "alpha(opacity=1)";
            b.style.backgroundColor = "white";
        }
        b.onmousedown = function(i) {
            i = SuperMap.Web.Utility.getEvent(i);
            SuperMap.Web.Utility.cancelBubble(i);
            return false;
        };
        this._container.appendChild(b);
        var f = document.createElement("div");
        f.style.position = "absolute";
        f.style.right = "40px";
        f.style.top = "18px";
        f.style.width = "18px";
        f.style.height = "18px";
        f.style.cursor = "pointer";
        f.style.zIndex = 300;
        f.title = "上移";
        this._putUpDelegate = Function.createDelegate(this, this._panUp);
        f.onclick = this._putUpDelegate;
        b.appendChild(f);
        var d = document.createElement("div");
        d.style.position = "absolute";
        d.style.right = "20px";
        d.style.top = "38px";
        d.style.width = "18px";
        d.style.height = "18px";
        d.style.cursor = "pointer";
        d.title = "左移";
        this._putLeftDelegate = Function.createDelegate(this, this._panLeft);
        $addHandler(d, "click", this._putLeftDelegate);
        b.appendChild(d);
        var h = document.createElement("div");
        h.style.position = "absolute";
        h.style.right = "60px";
        h.style.top = "38px";
        h.style.width = "18px";
        h.style.height = "18px";
        h.style.cursor = "pointer";
        h.title = "右移";
        this._putRightDelegate = Function.createDelegate(this, this._panRight);
        $addHandler(h, "click", this._putRightDelegate);
        b.appendChild(h);
        var a = document.createElement("div");
        a.style.position = "absolute";
        a.style.right = "40px";
        a.style.top = "58px";
        a.style.width = "18px";
        a.style.height = "18px";
        a.style.cursor = "pointer";
        a.title = "下移";
        this._putDownDelegate = Function.createDelegate(this, this._panDown);
        $addHandler(a, "click", this._putDownDelegate);
        b.appendChild(a);
        var g = document.createElement("div");
        g.style.position = "absolute";
        g.style.right = "40px";
        g.style.top = "38px";
        g.style.width = "18px";
        g.style.height = "18px";
        g.style.cursor = "pointer";
        g.title = "平移操作";
        this._putActionDelegate = Function.createDelegate(this, this._panAction);
        $addHandler(g, "click", this._putActionDelegate);
        b.appendChild(g);
    },
    _panUp: function() {
        var a = -1 * this._map.get_height() / 3;
        this._panMelody(0, a);
    },
    _panDown: function() {
        var a = this._map.get_height() / 3;
        this._panMelody(0, a);
    },
    _panLeft: function() {
        var a = -1 * this._map.get_width() / 3;
        this._panMelody(a, 0);
    },
    _panRight: function() {
        var a = this._map.get_width() / 3;
        this._panMelody(a, 0);
    },
    _panAction: function() {
        var a = $create(SuperMap.Web.Actions.Pan, { map: this._map }, null, null, null);
        this._map.set_action(a);
    },
    _panMelody: function(a, f) {
        if (this._panMelodyStart == false) {
            this._panMelodyStart = true;
            if (a == 0) {
                var e = f / 17;
                var c = 0;
            } else {
                var c = a / 17;
                var e = 0;
            }
            var b = Function.createDelegate(this, this._paramsTool);
            var d = b(c, e);
            this._panInterval = setInterval(d, 50);
        }
    },
    _paramsTool: function(b, c) {
        var a = Function.createDelegate(this, this._panNote);
        return (function() { a(b, c); });
    },
    _panNote: function(b, d) {
        this._panNoteNum++;
        var a = 0;
        var c = 0;
        if (this._panNoteNum == 1 || this._panNoteNum == 4 || this._panNoteNum == 5) {
            a = b * 2;
            c = d * 2;
        } else {
            if (this._panNoteNum == 2) {
                a = b * 6;
                c = d * 6;
            } else {
                if (this._panNoteNum == 3) {
                    a = b * 3;
                    c = d * 3;
                } else {
                    if (this._panNoteNum == 6 || this._panNoteNum == 7) {
                        a = b * 1;
                        c = d * 1;
                    }
                }
            }
        }
        if (this._panNoteNum == 7) {
            clearInterval(this._panInterval);
            this._panNoteNum = 0;
            this._panMelodyStart = false;
        }
        this._map.panByPixel(a, c);
    }
};
SuperMap.Web.Controls.Compass.registerClass("SuperMap.Web.Controls.Compass", SuperMap.Web.Controls.ControlBase);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.Legend = function(a) {
    SuperMap.Web.Controls.Legend.initializeBase(this);
    a = this._extend(a);
    this._layers = a.layers;
    this._id = a.id;
    this._isShowOnlyVisibleLayer = a.isShowOnlyVisibleLayer;
    this._legendContainer = a.container;
    this._sourceImageSize = a.sourceImageSize;
    this._sourceImageFormat = a.sourceImageFormat;
    this._layersCount = 0;
    this.layerItems = [];
};
SuperMap.Web.Controls.Legend.prototype = {
    initialize: function(a) {
        this._map = a;
        this._getLayerInfo(this._layers[this._layersCount++]);
    },
    dispose: function() {
        var a = this._legendContainer;
        if (a) {
            a.removeChild(this._legendDiv);
        }
        this._map = null;
        this.layerItems = [];
    },
    refresh: function() {
        var a = this._legendContainer;
        if (a) {
            a.removeChild(this._legendDiv);
        }
        this._createLegendDiv();
    },
    set_isShowOnlyVisibleLayer: function(a) {
        this._isShowOnlyVisibleLayer = a;
        this._showOnlyVisibleLayer();
    },
    get_isShowOnlyVisibleLayer: function() { return this._isShowOnlyVisibleLayer; },
    _showOnlyVisibleLayer: function() {
        var a = document.getElementsByTagName("tr");
        for (var b = 0; b < a.length; b++) {
            if (a[b].className == "sm_legendLayerRow_block" || a[b].className == "sm_legendLayerRow_none") {
                if (this._isShowOnlyVisibleLayer) {
                    if (a[b].className == "sm_legendLayerRow_block") {
                        a[b].style.display = "block";
                    } else {
                        if (a[b].className == "sm_legendLayerRow_none") {
                            a[b].style.display = "none";
                        }
                    }
                } else {
                    a[b].style.display = "block";
                }
            }
        }
    },
    _extend: function(b) {
        if (!b.layers || b.layers.length == 0) {
            throw new Error("Layers is null!");
        } else {
            for (var a in b.layers) {
                if (b.layers[a]._type != "TiledDynamicRESTLayer" && b.layers[a]._type != "DynamicRESTLayer") {
                    throw new Error("Layers is not iServer6!");
                }
            }
        }
        if (typeof(b.isShowOnlyVisibleLayer) === "undefined" || typeof(b.isShowOnlyVisibleLayer) != "boolean") {
            b.isShowOnlyVisibleLayer = true;
        }
        if (!b.container) {
            throw new Error("container is null!");
        }
        if (!b.sourceImageSize) {
            b.sourceImageSize = { };
            b.sourceImageSize.width = 16;
            b.sourceImageSize.height = 16;
        }
        if (!b.sourceImageFormat) {
            b.sourceImageFormat = "png";
        }
        if (!b.id) {
            throw new Error("Legend's id is null!");
        }
        return b;
    },
    _createLegendDiv: function() {
        this._legendDiv = document.createElement("div");
        this._legendDiv.className = "sm_legendDiv";
        for (var a in this.layerItems) {
            this._createLegendLayer(this.layerItems[a]);
        }
        this._legendContainer.appendChild(this._legendDiv);
        this._showOnlyVisibleLayer();
    },
    _createLegendLayer: function(f) {
        var c = document.createElement("div");
        c.className = "sm_legendLayer";
        var l = document.createElement("div");
        l.className = "sm_legendLayerName";
        var q = document.createElement("table");
        q.style.fontSize = "100%";
        q.setAttribute("cellspacing", "0");
        var e = document.createElement("tbody");
        var p = document.createElement("tr");
        var o = document.createElement("td");
        o.className = "sm_legendLayerNameControlCell_block";
        var m = document.createElement("td");
        var a = document.createElement("img");
        if (f.imageSource) {
            a.src = f.imageSource;
        } else {
            a.src = "scripts/libs/supermap/images/controls/world.png";
        }
        m.appendChild(a);
        var d = document.createElement("td");
        var k = document.createElement("span");
        k.appendChild(document.createTextNode(f.name));
        d.appendChild(k);
        p.appendChild(o);
        p.appendChild(m);
        p.appendChild(d);
        e.appendChild(p);
        q.appendChild(e);
        l.appendChild(q);
        var j = document.createElement("div");
        j.className = "sm_legendLayerLable";
        var n = document.createElement("table");
        n.style.fontSize = "100%";
        n.setAttribute("cellspacing", "0");
        var b = document.createElement("tbody");
        var h = f.layerItems;
        for (var g in h) {
            this._createLegendRow(b, h[g]);
        }
        c.appendChild(l);
        n.appendChild(b);
        j.appendChild(n);
        c.appendChild(j);
        this._legendDiv.appendChild(c);
        (function(i, t, r) {
            var s = Function.createDelegate(this, function() {
                if (r.style.display == "none") {
                    r.style.display = "block";
                    t.className = "sm_legendLayerNameControlCell_block";
                } else {
                    r.style.display = "none";
                    t.className = "sm_legendLayerNameControlCell_none";
                }
            });
            $addHandler(i, "dblclick", s);
            $addHandler(t, "click", s);
        })(l, o, j);
    },
    _createLegendRow: function(b, n) {
        var u = document.createElement("tr");
        if (n.isVisible) {
            u.className = "sm_legendLayerRow_block";
        } else {
            u.className = "sm_legendLayerRow_none";
        }
        var q = document.createElement("td");
        q.className = "sm_lineCell";
        var t = document.createElement("td");
        var r = document.createElement("td");
        r.className = "sm_placeCell";
        var c = document.createElement("table");
        c.style.fontSize = "100%";
        c.setAttribute("cellspacing", "2");
        var h = document.createElement("tbody");
        var k = document.createElement("tr");
        var o = document.createElement("td");
        var i = document.createElement("td");
        var a = document.createElement("img");
        a.setAttribute("src", n.imageSource);
        var f = document.createElement("span");
        f.appendChild(document.createTextNode(n.name));
        o.appendChild(a);
        i.appendChild(f);
        k.appendChild(o);
        k.appendChild(i);
        h.appendChild(k);
        c.appendChild(h);
        t.appendChild(c);
        u.appendChild(q);
        u.appendChild(r);
        u.appendChild(t);
        b.appendChild(u);
        if (n.layerItems != null && n.layerItems.length > 0) {
            r.className = "sm_placeCell_block";
            themeItems = n.layerItems;
            var v = document.createElement("tr");
            v.style.display = "none";
            var d = document.createElement("td");
            d.style.width = "9px";
            var j = document.createElement("td");
            j.style.width = "1px";
            var p = document.createElement("td");
            var g = document.createElement("table");
            g.style.fontSize = "100%";
            g.setAttribute("cellspacing", "2");
            var m = document.createElement("tbody");
            (function(y, x, w) {
                var z = Function.createDelegate(this, function() {
                    if (w.style.display == "none") {
                        w.style.display = "block";
                        x.className = "sm_placeCell_none";
                    } else {
                        w.style.display = "none";
                        x.className = "sm_placeCell_block";
                    }
                });
                $addHandler(y, "dblclick", z);
                $addHandler(x, "click", z);
            })(k, r, v);
            var l = document.createElement("td");
            l.className = "sm_placeLineCell";
            var e = document.createElement("td");
            var s = document.createElement("tr");
            s.appendChild(l);
            s.appendChild(e);
            m.appendChild(s);
            this._createThemeTable(e, themeItems);
            g.appendChild(m);
            p.appendChild(g);
            v.appendChild(d);
            v.appendChild(j);
            v.appendChild(p);
            b.appendChild(v);
        }
    },
    _createThemeTable: function(j, a) {
        var g = document.createElement("table");
        g.style.fontSize = "100%";
        g.setAttribute("cellspacing", "2");
        var k = document.createElement("tbody");
        for (var e in a) {
            var c = document.createElement("tr");
            var d = document.createElement("td");
            var f = document.createElement("td");
            var b = document.createElement("span");
            var h = document.createElement("img");
            h.setAttribute("src", a[e].imageSource);
            b.appendChild(document.createTextNode(a[e].name));
            f.appendChild(h);
            d.appendChild(b);
            c.appendChild(f);
            c.appendChild(d);
            k.appendChild(c);
        }
        g.appendChild(k);
        j.appendChild(g);
    },
    _getLayerInfo: function(a) {
        this._mapUrl = a.get_url();
        var c = new SuperMap.Web.iServerJava6R.GetLayersInfoService(this._mapUrl);
        var b = Function.createDelegate(this, this._getLayersInfoCompleted);
        c.add_processCompleted(b);
        c.processAsync();
    },
    _getLayersInfoCompleted: function(b) {
        var a = b.result;
        if (a && a.length > 0) {
            this._fillLayerItems(a);
        } else {
            this.layerItems = null;
        }
        if (this._layersCount < this._layers.length) {
            this._getLayerInfo(this._layers[this._layersCount++]);
        } else {
            var c = { layerItems: this.layerItems };
            this.raise_layerItemsInitCompleted(c);
            this._createLegendDiv();
        }
    },
    _fillLayerItems: function(l) {
        for (var e = 0; e < l.length; e++) {
            var b = { };
            b.name = l[0].name;
            b.description = l[0].description;
            b.isVisible = l[0].visible;
            b.imageSource = "";
            b.layerItems = [];
            var d = l[0].subLayers;
            if (typeof d === "object" && d.length > 0) {
                for (var c = 0; c < d.length; c++) {
                    var h = { };
                    h.name = d[c].name;
                    h.description = d[c].description;
                    h.isVisible = d[c].visible;
                    h.layerItems = [];
                    var g = this._mapUrl + "/layers/" + d[c].name + "@@" + b.name;
                    g = g.replace( /#/g , ".");
                    h.imageSource = g + "/legend." + this._sourceImageFormat + "?width=" + this._sourceImageSize.width + "&height=" + this._sourceImageSize.height;
                    if (d[c].ugcLayerType == "THEME" && d[c].theme.items != null) {
                        for (var a = 0; a < d[c].theme.items.length; a++) {
                            var f = { };
                            f.name = d[c].theme.items[a].caption;
                            f.description = "";
                            f.isVisible = d[c].theme.items[a].visible;
                            f.layerItems = "";
                            f.imageSource = g + "/items/" + a + "/legend." + this._sourceImageFormat + "?width=" + this._sourceImageSize.width + "&height=" + this._sourceImageSize.height;
                            h.layerItems.push(f);
                        }
                    }
                    b.layerItems.push(h);
                }
            }
            this.layerItems.push(b);
        }
    },
    add_layerItemsInitCompleted: function(a) { this.get_events().addHandler("layerItemsInitCompleted", a); },
    remove_layerItemsInitCompleted: function(a) { this.get_events().removeHandler("layerItemsInitCompleted", a); },
    raise_layerItemsInitCompleted: function(b, c) {
        var a = this.get_events().getHandler("layerItemsInitCompleted");
        if (a) {
            a(b, c);
        }
    }
};
SuperMap.Web.Controls.Legend.registerClass("SuperMap.Web.Controls.Legend", SuperMap.Web.Controls.ControlBase);
Type.registerNamespace("SuperMap.Web.Controls");
SuperMap.Web.Controls.layerItemsInitCompletedArgs = function() {
};
SuperMap.Web.Controls.layerItemsInitCompletedArgs.registerClass("SuperMap.Web.Controls.layerItemsInitCompletedArgs");
SuperMap.Web.Controls.LegendItemInfo = function() {
};
SuperMap.Web.Controls.LegendItemInfo.registerClass("SuperMap.Web.Controls.LegendItemInfo");